summaryrefslogtreecommitdiff
path: root/ot/optim.py
diff options
context:
space:
mode:
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