diff options
author | tlacombe <lacombe1993@gmail.com> | 2019-09-23 11:14:24 +0200 |
---|---|---|
committer | tlacombe <lacombe1993@gmail.com> | 2019-09-23 11:14:24 +0200 |
commit | 1b007fc59f08bd01e1521eb1c0773b598bdf158b (patch) | |
tree | 6a5169be2dd87c28a27cd0054a8d0cd3b251c178 /src/python/doc/wasserstein_distance_user.rst | |
parent | 36d82a6ffe7c099da9241f7268637feaeef6bf55 (diff) |
wasserstein distance added on fork
Diffstat (limited to 'src/python/doc/wasserstein_distance_user.rst')
-rw-r--r-- | src/python/doc/wasserstein_distance_user.rst | 39 |
1 files changed, 39 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..a51cfb71 --- /dev/null +++ b/src/python/doc/wasserstein_distance_user.rst @@ -0,0 +1,39 @@ +: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_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 + + 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_distance(diag1, diag2, q=2., p=1.) + print(message) + +The output is: + +.. testoutput:: + + Wasserstein distance value = 1.45 |