Fast, pointwise graph curvature
Project description
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:
- Unaffected by density fluctuations in data: it inherits the diffusion operator’s denoising properties.
- 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")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for diffusion_curvature-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83f55783947a5a36c40b336de9967a9fa963bf7417cdfbf640f1bce89d1eb689 |
|
MD5 | f277466d2323e9c42e9918514144edb8 |
|
BLAKE2b-256 | b71acf34dc23055d7a51269afe16a2f23fc697604768afc81b94c5e9e0b071fa |
Hashes for diffusion_curvature-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 239bf627b1c0ca462859043bb338d23441072da9b1aecda7a95ffd52fc5e7e75 |
|
MD5 | 74050bec909578594de13b8d44aea33e |
|
BLAKE2b-256 | 021536d1f609a086c801fdc5fd8c50f35f7237993b589c4568a378f7d184ba09 |