diff options
author | Gard Spreemann <gspr@nonempty.org> | 2020-01-20 09:33:33 +0100 |
---|---|---|
committer | Gard Spreemann <gspr@nonempty.org> | 2020-01-20 09:33:33 +0100 |
commit | 8c751c3929b1727c1e2e2781259ddaa39cfd8df3 (patch) | |
tree | 0e680ea9182032cc82a732230217980ada093ee9 /src/python/doc/wasserstein_distance_user.rst | |
parent | a11db9cb0c8b35fa393c95d698754bb0c652b1d6 (diff) | |
parent | 9acc59fcc1d5001a212e7b9cd6f00a569a625882 (diff) |
Merge branch 'dfsg/latest' into debian/sid
Diffstat (limited to 'src/python/doc/wasserstein_distance_user.rst')
-rw-r--r-- | src/python/doc/wasserstein_distance_user.rst | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/python/doc/wasserstein_distance_user.rst b/src/python/doc/wasserstein_distance_user.rst new file mode 100644 index 00000000..32999a0c --- /dev/null +++ b/src/python/doc/wasserstein_distance_user.rst @@ -0,0 +1,40 @@ +:orphan: + +.. To get rid of WARNING: document isn't included in any toctree + +Wasserstein distance user manual +================================ +Definition +---------- + +.. include:: wasserstein_distance_sum.inc + +This implementation is based on ideas from "Large Scale Computation of Means and Cluster for Persistence Diagrams via Optimal Transport". + +Function +-------- +.. autofunction:: gudhi.wasserstein.wasserstein_distance + + +Basic example +------------- + +This example computes the 1-Wasserstein distance from 2 persistence diagrams with euclidean ground metric. +Note that persistence diagrams must be submitted as (n x 2) numpy arrays and must not contain inf values. + +.. testcode:: + + import gudhi.wasserstein + import numpy as np + + diag1 = np.array([[2.7, 3.7],[9.6, 14.],[34.2, 34.974]]) + diag2 = np.array([[2.8, 4.45],[9.5, 14.1]]) + + message = "Wasserstein distance value = " + '%.2f' % gudhi.wasserstein.wasserstein_distance(diag1, diag2, order=1., internal_p=2.) + print(message) + +The output is: + +.. testoutput:: + + Wasserstein distance value = 1.45 |