Giter VIP home page Giter VIP logo

diffusion-curvature-old's Introduction

Diffusion Curvature

Diffusion curvature is a pointwise extension of Ollivier-Ricci curvature, designed specifically for the often messy world of pointcloud data. Its advantages include: 1. Unaffected by density fluctuations in data: it inherits the diffusion operator’s denoising properties. 2. Fast, and scalable to millions of points: it depends only on matrix powering - no optimal transport required.

Install

It’s not yet available via PyPI. In the meantime, you can run:

pip install git+git://github.com/professorwug/diffusion_curvature@master

Usage

To compute diffusion curvature, first create a graphtools graph with your data. Graphtools offers extensive support for different kernel types (if creating from a pointcloud), and can also work with graphs in the PyGSP format. We recommend using anistropy=1, and verifying that the supplied knn value encompasses a reasonable portion of the graph.

from diffusion_curvature.datasets import torus
import graphtools
X_torus, torus_gaussian_curvature = torus(n=5000)
G_torus = graphtools.Graph(X_torus, anisotropy=1, knn=30)

Next, instantiate a DiffusionCurvature operator.

from diffusion_curvature.graphtools import DiffusionCurvature
DC = DiffusionCurvature(t=12)

DiffusionCurvature

 DiffusionCurvature (t:int, distance_type='PHATE', use_entropy:bool=False,
                     **kwargs)

Initialize self. See help(type(self)) for accurate signature.

Type Default Details
t int Number of diffusion steps to use when measuring curvature. TODO: Heuristics
distance_type str PHATE
use_entropy bool False If true, uses KL Divergence instead of Wasserstein Distances. Faster, seems empirically as good, but less proven.
kwargs

And, finally, pass your graph through it. The DiffusionCurvature operator will store everything it computes – the powered diffusion matrix, the estimated manifold distances, and the curvatures – as attributes of your graph. To get the curvatures, you can run G.ks.

G_torus = DC.curvature(G_torus, dimension=2)
plot_3d(X_torus, G_torus.ks, colorbar=True, title="Diffusion Curvature on the torus")

diffusion-curvature-old's People

Contributors

professorwug avatar

Watchers

Bastian Rieck avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.