summaryrefslogtreecommitdiff
path: root/ot/lp/__init__.py
diff options
context:
space:
mode:
authorAntoine Rolet <antoine.rolet@gmail.com>2017-09-09 17:38:31 +0900
committerAntoine Rolet <antoine.rolet@gmail.com>2017-09-09 17:38:31 +0900
commitcd8c04246b6d1f15b68d6433741e8c808fd517d8 (patch)
treeaf45a723fb29644b7be75b20db48bf238cdf6296 /ot/lp/__init__.py
parent1ba2c837d54ce963ad63ddf8df2e47230800b747 (diff)
Renamed variable
Diffstat (limited to 'ot/lp/__init__.py')
-rw-r--r--ot/lp/__init__.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/ot/lp/__init__.py b/ot/lp/__init__.py
index 1238cdb..9a0cb1c 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, num_iter_max=100000, log=False):
+def emd(a, b, M, max_iter=100000, log=False):
"""Solves the Earth Movers distance problem and returns the OT matrix
@@ -41,7 +41,7 @@ def emd(a, b, M, num_iter_max=100000, log=False):
Target histogram (uniform weigth if empty list)
M : (ns,nt) ndarray, float64
loss matrix
- num_iter_max : int, optional (default=100000)
+ max_iter : 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, num_iter_max=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, num_iter_max)
+ G, cost, u, v, result_code = emd_c(a, b, M, max_iter)
result_code_string = check_result(result_code)
if log:
log = {}
@@ -107,7 +107,7 @@ def emd(a, b, M, num_iter_max=100000, log=False):
return G
-def emd2(a, b, M, processes=multiprocessing.cpu_count(), num_iter_max=100000, log=False):
+def emd2(a, b, M, processes=multiprocessing.cpu_count(), max_iter=100000, log=False):
"""Solves the Earth Movers distance problem and returns the loss
.. math::
@@ -131,7 +131,7 @@ def emd2(a, b, M, processes=multiprocessing.cpu_count(), num_iter_max=100000, lo
Target histogram (uniform weigth if empty list)
M : (ns,nt) ndarray, float64
loss matrix
- num_iter_max : int, optional (default=100000)
+ max_iter : int, optional (default=100000)
The maximum number of iterations before stopping the optimization
algorithm if it has not converged.
@@ -183,7 +183,7 @@ def emd2(a, b, M, processes=multiprocessing.cpu_count(), num_iter_max=100000, lo
if log:
def f(b):
- G, cost, u, v, resultCode = emd_c(a, b, M, num_iter_max)
+ G, cost, u, v, resultCode = emd_c(a, b, M, max_iter)
result_code_string = check_result(resultCode)
log = {}
log['G'] = G
@@ -194,7 +194,7 @@ def emd2(a, b, M, processes=multiprocessing.cpu_count(), num_iter_max=100000, lo
return [cost, log]
else:
def f(b):
- G, cost, u, v, result_code = emd_c(a, b, M, num_iter_max)
+ G, cost, u, v, result_code = emd_c(a, b, M, max_iter)
check_result(result_code)
return cost