summaryrefslogtreecommitdiff
path: root/ot/lp/__init__.py
diff options
context:
space:
mode:
authorAntoine Rolet <antoine.rolet@gmail.com>2017-09-09 18:23:05 +0900
committerAntoine Rolet <antoine.rolet@gmail.com>2017-09-09 18:23:05 +0900
commit06429e5a34790ec51eb1c921293b24c37b81b952 (patch)
treed4c8a5fcf9eea901a0f39c79f2e61d3f11d8c9f4 /ot/lp/__init__.py
parent8cc04ef5ae8806c81811b2081b1880b46ca063a3 (diff)
Returned to old variable name to follow repo convention
Diffstat (limited to 'ot/lp/__init__.py')
-rw-r--r--ot/lp/__init__.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/ot/lp/__init__.py b/ot/lp/__init__.py
index ae5b08c..17f5bb4 100644
--- a/ot/lp/__init__.py
+++ b/ot/lp/__init__.py
@@ -16,7 +16,7 @@ from .emd_wrap import emd_c, check_result
from ..utils import parmap
-def emd(a, b, M, max_iter=100000, log=False):
+def emd(a, b, M, num_iter_max=100000, log=False):
"""Solves the Earth Movers distance problem and returns the OT matrix
@@ -41,7 +41,7 @@ def emd(a, b, M, max_iter=100000, log=False):
Target histogram (uniform weigth if empty list)
M : (ns,nt) ndarray, float64
loss matrix
- max_iter : int, optional (default=100000)
+ num_iter_max : int, optional (default=100000)
The maximum number of iterations before stopping the optimization
algorithm if it has not converged.
log: boolean, optional (default=False)
@@ -94,7 +94,7 @@ def emd(a, b, M, max_iter=100000, log=False):
if len(b) == 0:
b = np.ones((M.shape[1],), dtype=np.float64) / M.shape[1]
- G, cost, u, v, result_code = emd_c(a, b, M, max_iter)
+ G, cost, u, v, result_code = emd_c(a, b, M, num_iter_max)
result_code_string = check_result(result_code)
if log:
log = {}
@@ -107,7 +107,7 @@ def emd(a, b, M, max_iter=100000, log=False):
return G
-def emd2(a, b, M, processes=multiprocessing.cpu_count(), max_iter=100000, log=False):
+def emd2(a, b, M, processes=multiprocessing.cpu_count(), num_iter_max=100000, log=False):
"""Solves the Earth Movers distance problem and returns the loss
.. math::
@@ -183,7 +183,7 @@ def emd2(a, b, M, processes=multiprocessing.cpu_count(), max_iter=100000, log=Fa
if log:
def f(b):
- G, cost, u, v, resultCode = emd_c(a, b, M, max_iter)
+ G, cost, u, v, resultCode = emd_c(a, b, M, num_iter_max)
result_code_string = check_result(resultCode)
log = {}
log['G'] = G
@@ -194,7 +194,7 @@ def emd2(a, b, M, processes=multiprocessing.cpu_count(), max_iter=100000, log=Fa
return [cost, log]
else:
def f(b):
- G, cost, u, v, result_code = emd_c(a, b, M, max_iter)
+ G, cost, u, v, result_code = emd_c(a, b, M, num_iter_max)
check_result(result_code)
return cost