Skip to main content

Diffusion Earth Mover’s Distance embeds the Wasserstein distance between two distributions on a graph into L^1 in log-linear time.

Installation

DiffusionEMD is available in pypi. Install by running the following:

pip install DiffusionEMD

Quick Start

DiffusionEMD is written following the sklearn estimator framework. We provide two functions that operate quite differently. First the Chebyshev approxiamtion of the operator in DiffusionCheb, which we recommend when the number of distributions is small compared to the number of points. Second, the Interpolative Decomposition method that computes dyadic powers of $P^{2^k}$ directly in DiffusionTree. These two classes are used in the same way, first supplying parameters, fitting to a graph and array of distributions:

import numpy as np
from DiffusionEMD import DiffusionCheb

# Setup an adjacency matrix and a set of distributions to embed
adj = np.ones((10, 10))
distributions = np.random.randn(10, 5)
dc = DiffusionCheb()

# Embeddings where the L1 distance approximates the Earth Mover's Distance
embeddings = dc.fit_transform(adj, distributions)
# Shape: (5, 60)

Requirements can be found in requirements.txt

Examples

Examples are in the notebooks directory.

Take a look at the examples provided there to get a sense of how the parameters behave on simple examples that are easy to visualize.

Paper

This code implements the algorithms described in this paper:

ArXiv Link: http://arxiv.org/abs/2102.12833:

@InProceedings{pmlr-v139-tong21a,
  title =       {Diffusion Earth Mover’s Distance and Distribution Embeddings},
  author =      {Tong, Alexander Y and Huguet, Guillaume and Natik, Amine and Macdonald, Kincaid and Kuchroo, Manik and Coifman, Ronald and Wolf, Guy and Krishnaswamy, Smita},
  booktitle =   {Proceedings of the 38th International Conference on Machine Learning},
  pages =       {10336--10346},
  year =        {2021},
  editor =      {Meila, Marina and Zhang, Tong},
  volume =      {139},
  series =      {Proceedings of Machine Learning Research},
  month =       {18--24 Jul},
  publisher =   {PMLR},
  pdf =         {http://proceedings.mlr.press/v139/tong21a/tong21a.pdf},
  url =         {http://proceedings.mlr.press/v139/tong21a.html},
}

Metadata

Release files for DiffusionEMD 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for DiffusionEMD 0.5.0
File Size Uploaded
DiffusionEMD-0.5.0.tar.gz 18.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for DiffusionEMD 0.5.0
File Interpreter ABI Platform
DiffusionEMD-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 40.2 kB

Release files / DiffusionEMD-0.5.0.tar.gz

Download URL DiffusionEMD-0.5.0.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4578650f4435d8d5a1537490bc4cf47c5f3c2719ec09e8c47aa193f25a59b5c1
BLAKE2b-256 checksum
How to use checksums
bca8924b92ea9868c60073549505ff766613b193a53813f3822bd8026a8581e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release files / DiffusionEMD-0.5.0-py3-none-any.whl

Download URL DiffusionEMD-0.5.0-py3-none-any.whl
Size 21.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28607b1394f8496561eebfcf73d622a93df7a5d02ecc9b1d76b5645b1d02518e
BLAKE2b-256 checksum
How to use checksums
a3cf0031c42c3bc6936087852ed6704b8c1133ff64f29dfe4a5f4f5fe9392c40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page