summaryrefslogtreecommitdiff
path: root/ot/lp/__init__.py
diff options
context:
space:
mode:
authorRomain Tavenard <romain.tavenard@univ-rennes2.fr>2019-06-27 10:23:32 +0200
committerRomain Tavenard <romain.tavenard@univ-rennes2.fr>2019-06-27 10:23:32 +0200
commit0d333e004636f5d25edea6bb195e8e4d9a95ba98 (patch)
tree75b40d64101c0f503e6ed8d3101db1c095ffbd72 /ot/lp/__init__.py
parent1140141938c678d267f688dbb9106d3422d633c5 (diff)
Improved tests and docs for wasserstein_1d
Diffstat (limited to 'ot/lp/__init__.py')
-rw-r--r--ot/lp/__init__.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/ot/lp/__init__.py b/ot/lp/__init__.py
index 719032b..76c9ec0 100644
--- a/ot/lp/__init__.py
+++ b/ot/lp/__init__.py
@@ -530,13 +530,13 @@ def emd2_1d(x_a, x_b, a=None, b=None, metric='sqeuclidean', p=1., dense=True,
def wasserstein_1d(x_a, x_b, a=None, b=None, p=1., dense=True, log=False):
- """Solves the Wasserstein distance problem between 1d measures and returns
+ """Solves the p-Wasserstein distance problem between 1d measures and returns
the OT matrix
.. math::
- \gamma = arg\min_\gamma \left(\sum_i \sum_j \gamma_{ij}
- |x_a[i] - x_b[j]|^p \right)^{1/p}
+ \gamma = arg\min_\gamma \left( \sum_i \sum_j \gamma_{ij}
+ |x_a[i] - x_b[j]|^p \\right)^{1/p}
s.t. \gamma 1 = a,
\gamma^T 1= b,
@@ -617,15 +617,14 @@ def wasserstein_1d(x_a, x_b, a=None, b=None, p=1., dense=True, log=False):
dense=dense, log=log)
-def wasserstein2_1d(x_a, x_b, a=None, b=None, metric='sqeuclidean', p=1.,
- dense=True, log=False):
- """Solves the Wasserstein distance problem between 1d measures and returns
+def wasserstein2_1d(x_a, x_b, a=None, b=None, p=1., dense=True, log=False):
+ """Solves the p-Wasserstein distance problem between 1d measures and returns
the loss
.. math::
\gamma = arg\min_\gamma \left( \sum_i \sum_j \gamma_{ij}
- |x_a[i] - x_b[j]|^p \right)^{1/p}
+ |x_a[i] - x_b[j]|^p \\right)^{1/p}
s.t. \gamma 1 = a,
\gamma^T 1= b,