Skip to content

Commit 7c02007

Browse files
Kilian FatrasKilian Fatras
authored andcommitted
fix doc
1 parent 9cfcbc4 commit 7c02007

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

ot/bregman.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,9 +1317,9 @@ def empirical_sinkhorn(X_s, X_t, reg, a=None, b=None, metric='sqeuclidean', numI
13171317
\gamma\geq 0
13181318
where :
13191319
1320-
- M is the (ns,nt) metric cost matrix
1320+
- :math:`M` is the (ns,nt) metric cost matrix
13211321
- :math:`\Omega` is the entropic regularization term :math:`\Omega(\gamma)=\sum_{i,j} \gamma_{i,j}\log(\gamma_{i,j})`
1322-
- a and b are source and target weights (sum to 1)
1322+
- :math:`a` and :math:`b` are source and target weights (sum to 1)
13231323
13241324
13251325
Parameters
@@ -1399,7 +1399,7 @@ def empirical_sinkhorn2(X_s, X_t, reg, a=None, b=None, metric='sqeuclidean', num
13991399
The function solves the following optimization problem:
14001400
14011401
.. math::
1402-
W = \min_\gamma_\gamma <\gamma,M>_F + reg\cdot\Omega(\gamma)
1402+
W = \min_\gamma <\gamma,M>_F + reg\cdot\Omega(\gamma)
14031403
14041404
s.t. \gamma 1 = a
14051405
@@ -1408,9 +1408,9 @@ def empirical_sinkhorn2(X_s, X_t, reg, a=None, b=None, metric='sqeuclidean', num
14081408
\gamma\geq 0
14091409
where :
14101410
1411-
- M is the (ns,nt) metric cost matrix
1411+
- :math:`M` is the (ns,nt) metric cost matrix
14121412
- :math:`\Omega` is the entropic regularization term :math:`\Omega(\gamma)=\sum_{i,j} \gamma_{i,j}\log(\gamma_{i,j})`
1413-
- a and b are source and target weights (sum to 1)
1413+
- :math:`a` and :math:`b` are source and target weights (sum to 1)
14141414
14151415
14161416
Parameters
@@ -1484,13 +1484,20 @@ def empirical_sinkhorn_divergence(X_s, X_t, reg, a=None, b=None, metric='sqeucli
14841484
'''
14851485
Compute the sinkhorn divergence loss from empirical data
14861486
1487-
The function solves the following optimization problem:
1487+
The function solves the following optimization problems and return the
1488+
sinkhorn divergence :math:`S`:
14881489
14891490
.. math::
1490-
S = \min_\gamma <\gamma,M>_F + reg\cdot\Omega(\gamma) -
1491-
\min_\gamma_a <\gamma_a,M_a>_F + reg\cdot\Omega(\gamma_a) -
1492-
\min_\gamma_b <\gamma_b,M_b>_F + reg\cdot\Omega(\gamma_b)
14931491
1492+
W &= \min_\gamma <\gamma,M>_F + reg\cdot\Omega(\gamma)
1493+
1494+
W_a &= \min_{\gamma_a} <\gamma_a,M_a>_F + reg\cdot\Omega(\gamma_a)
1495+
1496+
W_b &= \min_{\gamma_b} <\gamma_b,M_b>_F + reg\cdot\Omega(\gamma_b)
1497+
1498+
S &= W - 1/2 * (W_a + W_b)
1499+
1500+
.. math::
14941501
s.t. \gamma 1 = a
14951502
14961503
\gamma^T 1= b
@@ -1510,9 +1517,9 @@ def empirical_sinkhorn_divergence(X_s, X_t, reg, a=None, b=None, metric='sqeucli
15101517
\gamma_b\geq 0
15111518
where :
15121519
1513-
- M (resp. :math:`M_a, M_b) is the (ns,nt) metric cost matrix (resp (ns, ns) and (nt, nt))
1520+
- :math:`M` (resp. :math:`M_a, M_b`) is the (ns,nt) metric cost matrix (resp (ns, ns) and (nt, nt))
15141521
- :math:`\Omega` is the entropic regularization term :math:`\Omega(\gamma)=\sum_{i,j} \gamma_{i,j}\log(\gamma_{i,j})`
1515-
- a and b are source and target weights (sum to 1)
1522+
- :math:`a` and :math:`b` are source and target weights (sum to 1)
15161523
15171524
15181525
Parameters

ot/stochastic.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,11 @@ def solve_semi_dual_entropic(a, b, M, reg, method, numItermax=10000, lr=None,
348348
349349
.. math::
350350
\gamma = arg\min_\gamma <\gamma,M>_F + reg\cdot\Omega(\gamma)
351+
351352
s.t. \gamma 1 = a
353+
352354
\gamma^T 1= b
355+
353356
\gamma \geq 0
354357
355358
Where :

0 commit comments

Comments
 (0)