summaryrefslogtreecommitdiff
path: root/ot/optim.py
diff options
context:
space:
mode:
authorKilian <kilian.fatras@gmail.com>2019-11-15 16:10:37 +0100
committerKilian <kilian.fatras@gmail.com>2019-11-15 16:10:37 +0100
commit0280a3441b09c781035cda3b74213ec92026ff9e (patch)
tree23d068d2485b919a67696088d603e22e32d76ff0 /ot/optim.py
parent2a32e2ea64d0d5096953a9b8259b0507fa58dca5 (diff)
fix bug numItermax emd in cg
Diffstat (limited to 'ot/optim.py')
-rw-r--r--ot/optim.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/ot/optim.py b/ot/optim.py
index 0abd9e9..4012e0d 100644
--- a/ot/optim.py
+++ b/ot/optim.py
@@ -134,7 +134,7 @@ def solve_linesearch(cost, G, deltaG, Mi, f_val,
return alpha, fc, f_val
-def cg(a, b, M, reg, f, df, G0=None, numItermax=200,
+def cg(a, b, M, reg, f, df, G0=None, numItermax=200, numItermaxEmd=100000,
stopThr=1e-9, stopThr2=1e-9, verbose=False, log=False, **kwargs):
"""
Solve the general regularized OT problem with conditional gradient
@@ -172,6 +172,8 @@ def cg(a, b, M, reg, f, df, G0=None, numItermax=200,
initial guess (default is indep joint density)
numItermax : int, optional
Max number of iterations
+ numItermaxEmd : int, optional
+ Max number of iterations for emd
stopThr : float, optional
Stop threshol on the relative variation (>0)
stopThr2 : float, optional
@@ -238,7 +240,7 @@ def cg(a, b, M, reg, f, df, G0=None, numItermax=200,
Mi += Mi.min()
# solve linear program
- Gc = emd(a, b, Mi)
+ Gc = emd(a, b, Mi, numItermax=numItermaxEmd)
deltaG = Gc - G