summaryrefslogtreecommitdiff
path: root/ot/lp
diff options
context:
space:
mode:
authoraje <leo_g_autheron@hotmail.fr>2017-08-30 10:06:41 +0200
committerNicolas Courty <Nico@MacBook-Pro-de-Nicolas.local>2017-09-01 11:09:13 +0200
commit8875f653e57aa11c8d62d291abb16fdbeff65511 (patch)
treef82bb152b7d51a48615a2b553a32d1b8afd790b2 /ot/lp
parentceeb063541fa71d4ddd7b13b043f985dc5bcab14 (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)