summaryrefslogtreecommitdiff
path: root/ot/lp
diff options
context:
space:
mode:
authoraje <leo_g_autheron@hotmail.fr>2017-08-30 10:06:41 +0200
committeraje <leo_g_autheron@hotmail.fr>2017-08-30 10:06:41 +0200
commitfeef989b155c0b77a1a014e58db7db390b1ee6d4 (patch)
tree096b12d323a8b7a5ee93db7d0b0ff719451c618f /ot/lp
parent982f36cb0a5f3a6a14454238a26053de7251b0f0 (diff)
Rename for emd and emd2
Diffstat (limited to 'ot/lp')
-rw-r--r--ot/lp/__init__.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/ot/lp/__init__.py b/ot/lp/__init__.py
index 7bef648..de91e74 100644
--- a/ot/lp/__init__.py
+++ b/ot/lp/__init__.py
@@ -14,7 +14,7 @@ from ..utils import parmap
import multiprocessing
-def emd(a, b, M, max_iter=100000):
+def emd(a, b, M, numItermax=100000):
"""Solves the Earth Movers distance problem and returns the OT matrix
@@ -39,7 +39,7 @@ def emd(a, b, M, max_iter=100000):
Target histogram (uniform weigth if empty list)
M : (ns,nt) ndarray, float64
loss matrix
- max_iter : int, optional (default=100000)
+ numItermax : int, optional (default=100000)
The maximum number of iterations before stopping the optimization
algorithm if it has not converged.
@@ -86,10 +86,10 @@ def emd(a, b, M, max_iter=100000):
if len(b) == 0:
b = np.ones((M.shape[1], ), dtype=np.float64)/M.shape[1]
- return emd_c(a, b, M, max_iter)
+ return emd_c(a, b, M, numItermax)
-def emd2(a, b, M, processes=multiprocessing.cpu_count(), max_iter=100000):
+def emd2(a, b, M, processes=multiprocessing.cpu_count(), numItermax=100000):
"""Solves the Earth Movers distance problem and returns the loss
.. math::
@@ -113,7 +113,7 @@ def emd2(a, b, M, processes=multiprocessing.cpu_count(), max_iter=100000):
Target histogram (uniform weigth if empty list)
M : (ns,nt) ndarray, float64
loss matrix
- max_iter : int, optional (default=100000)
+ numItermax : int, optional (default=100000)
The maximum number of iterations before stopping the optimization
algorithm if it has not converged.
@@ -161,12 +161,12 @@ def emd2(a, b, M, processes=multiprocessing.cpu_count(), max_iter=100000):
b = np.ones((M.shape[1], ), dtype=np.float64)/M.shape[1]
if len(b.shape) == 1:
- return emd2_c(a, b, M, max_iter)
+ return emd2_c(a, b, M, numItermax)
else:
nb = b.shape[1]
- # res = [emd2_c(a, b[:, i].copy(), M, max_iter) for i in range(nb)]
+ # res = [emd2_c(a, b[:, i].copy(), M, numItermax) for i in range(nb)]
def f(b):
- return emd2_c(a, b, M, max_iter)
+ return emd2_c(a, b, M, numItermax)
res = parmap(f, [b[:, i] for i in range(nb)], processes)
return np.array(res)