summaryrefslogtreecommitdiff
path: root/ot/optim.py
diff options
context:
space:
mode:
authorGard Spreemann <gspr@nonempty.org>2020-07-09 08:50:11 +0200
committerGard Spreemann <gspr@nonempty.org>2020-07-09 08:50:11 +0200
commit616c6039614e96b6cfd88eb7db25ce11c7302c30 (patch)
treea745ec24604f660b256dbaee214affa497c9c21e /ot/optim.py
parentd62f05daf348b4e554056f298c66cbd64f5e3c6e (diff)
parenta16b9471d7114ec08977479b7249efe747702b97 (diff)
Merge branch 'dfsg/latest' into debian/sid
Diffstat (limited to 'ot/optim.py')
-rw-r--r--ot/optim.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/ot/optim.py b/ot/optim.py
index 0abd9e9..b9ca891 100644
--- a/ot/optim.py
+++ b/ot/optim.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
-Optimization algorithms for OT
+Generic solvers for regularized OT
"""
# Author: Remi Flamary <remi.flamary@unice.fr>
@@ -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