summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortlacombe <lacombe1993@gmail.com>2019-12-05 18:52:16 +0100
committertlacombe <lacombe1993@gmail.com>2019-12-05 18:52:16 +0100
commit56a9294ede73d0660ba724b4f448c02dcd5e3dcc (patch)
treeb8aab2160c54cac0e396679fd7268d0f1f71c88d
parent80aa14d1b92d1a61366d798b07073289d4db4fda (diff)
added image for barycenter in the /img repository
-rw-r--r--src/python/doc/barycenter_sum.inc6
-rw-r--r--src/python/doc/img/barycenter.pngbin0 -> 12433 bytes
-rw-r--r--src/python/gudhi/barycenter.py33
3 files changed, 20 insertions, 19 deletions
diff --git a/src/python/doc/barycenter_sum.inc b/src/python/doc/barycenter_sum.inc
index 7801a845..afac07d7 100644
--- a/src/python/doc/barycenter_sum.inc
+++ b/src/python/doc/barycenter_sum.inc
@@ -3,7 +3,7 @@
+-----------------------------------------------------------------+----------------------------------------------------------------------+------------------------------------------------------------------+
| .. figure:: | A Frechet mean (or barycenter) is a generalization of the arithmetic | :Author: Theo Lacombe |
- | ../../doc/Barycenter/barycenter.png | mean in a non linear space such as the one of persistence diagrams. | |
+ | ./img/barycenter.png | mean in a non linear space such as the one of persistence diagrams. | |
| :figclass: align-center | Given a set of persistence diagrams :math:`\mu_1 \dots \mu_n`, it is | :Introduced in: GUDHI 3.1.0 |
| | defined as a minimizer of the variance functional, that is of | |
| Illustration of Frechet mean between persistence | :math:`\mu \mapsto \sum_{i=1}^n d_2(\mu,\mu_i)^2`. | :Copyright: MIT |
@@ -14,7 +14,9 @@
| | -lable is based on [Turner et al, 2014], and uses an EM-scheme to | |
| | provide a local minimum of the variance functional (somewhat similar | |
| | to the Lloyd algorithm to estimate a solution to the k-means | |
- | | problem). The combinatorial structure of the algorithm limits its | |
+ | | problem). The local minimum returned depends on the initialization of| |
+ | | the barycenter. | |
+ | | The combinatorial structure of the algorithm limits its | |
| | scaling on large scale problems (thousands of diagrams and of points | |
| | per diagram). | |
+-----------------------------------------------------------------+----------------------------------------------------------------------+------------------------------------------------------------------+
diff --git a/src/python/doc/img/barycenter.png b/src/python/doc/img/barycenter.png
new file mode 100644
index 00000000..cad6af70
--- /dev/null
+++ b/src/python/doc/img/barycenter.png
Binary files differ
diff --git a/src/python/gudhi/barycenter.py b/src/python/gudhi/barycenter.py
index 3cd214a7..b4afdb6a 100644
--- a/src/python/gudhi/barycenter.py
+++ b/src/python/gudhi/barycenter.py
@@ -293,13 +293,12 @@ def _test_perf():
def _sanity_check(verbose):
- #dg1 = np.array([[0.2, 0.5]])
- #dg2 = np.array([[0.2, 0.7]])
- #dg3 = np.array([[0.3, 0.6], [0.7, 0.8], [0.2, 0.3]])
- #dg4 = np.array([[0.72, 0.82]])
- #X = [dg1, dg2, dg3, dg4]
- #Y, a = lagrangian_barycenter(X, verbose=verbose)
- #_plot_barycenter(X, Y, a)
+ dg1 = np.array([[0.2, 0.5]])
+ dg2 = np.array([[0.2, 0.7], [0.73, 0.88]])
+ dg3 = np.array([[0.3, 0.6], [0.7, 0.85], [0.2, 0.3]])
+ X = [dg1, dg2, dg3]
+ Y, a = lagrangian_barycenter(X, verbose=verbose)
+ _plot_barycenter(X, Y, a)
#dg1 = np.array([[0.2, 0.5]])
#dg2 = np.array([]) # The empty diagram
@@ -323,16 +322,16 @@ def _sanity_check(verbose):
#_plot_barycenter(X, Y, a)
- dg1 = np.array([[0.2, 0.5]])
- dg2 = np.array([[0.2, 0.7]])
- dg3 = np.array([[0.3, 0.6], [0.7, 0.8], [0.2, 0.3]])
- dg4 = np.array([])
-
- bary = lagrangian_barycenter(pdiagset=[dg1, dg2, dg3, dg4],init=3)
-
- message = "Wasserstein barycenter estimated:"
- print(message)
- print(bary)
+ #dg1 = np.array([[0.2, 0.5]])
+ #dg2 = np.array([[0.2, 0.7]])
+ #dg3 = np.array([[0.3, 0.6], [0.7, 0.8], [0.2, 0.3]])
+ #dg4 = np.array([])
+ #
+ #bary, a = lagrangian_barycenter(pdiagset=[dg1, dg2, dg3, dg4],init=3, verbose=True)
+ #_plot_barycenter([dg1, dg2, dg3, dg4], bary, a)
+ #message = "Wasserstein barycenter estimated:"
+ #print(message)
+ #print(bary)
if __name__=="__main__":
_sanity_check(verbose = True)