You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.. [10] Chizat, L., Peyré, G., Schmitzer, B., & Vialard, F. X. (2016). Scaling algorithms for unbalanced transport problems. arXiv preprint arXiv:1607.05816.
199
203
204
+
[21] Altschuler J., Weed J., Rigollet P. : Near-linear time approximation algorithms for optimal transport via Sinkhorn iteration, Advances in Neural Information Processing Systems (NIPS) 31, 2017
- :math:`\Omega` is the entropic regularization term :math:`\Omega(\gamma)=\sum_{i,j} \gamma_{i,j}\log(\gamma_{i,j})`
447
+
- a and b are source and target weights (sum to 1)
448
+
449
+
450
+
451
+
Parameters
452
+
----------
453
+
a : np.ndarray (ns,)
454
+
samples weights in the source domain
455
+
b : np.ndarray (nt,) or np.ndarray (nt,nbb)
456
+
samples in the target domain, compute sinkhorn with multiple targets
457
+
and fixed M if b is a matrix (return OT loss + dual variables in log)
458
+
M : np.ndarray (ns,nt)
459
+
loss matrix
460
+
reg : float
461
+
Regularization term >0
462
+
numItermax : int, optional
463
+
Max number of iterations
464
+
stopThr : float, optional
465
+
Stop threshol on error (>0)
466
+
log : bool, optional
467
+
record log if True
468
+
469
+
470
+
Returns
471
+
-------
472
+
gamma : (ns x nt) ndarray
473
+
Optimal transportation matrix for the given parameters
474
+
log : dict
475
+
log dictionary return only if log==True in parameters
476
+
477
+
Examples
478
+
--------
479
+
480
+
>>> import ot
481
+
>>> a=[.5,.5]
482
+
>>> b=[.5,.5]
483
+
>>> M=[[0.,1.],[1.,0.]]
484
+
>>> ot.sinkhorn(a,b,M,1)
485
+
array([[ 0.36552929, 0.13447071],
486
+
[ 0.13447071, 0.36552929]])
487
+
488
+
489
+
References
490
+
----------
491
+
492
+
.. [2] M. Cuturi, Sinkhorn Distances : Lightspeed Computation of Optimal Transport, Advances in Neural Information Processing Systems (NIPS) 26, 2013
493
+
[21] J. Altschuler, J.Weed, P. Rigollet : Near-linear time approximation algorithms for optimal transport via Sinkhorn iteration, Advances in Neural Information Processing Systems (NIPS) 31, 2017
494
+
495
+
496
+
See Also
497
+
--------
498
+
ot.lp.emd : Unregularized OT
499
+
ot.optim.cg : General regularized OT
500
+
501
+
"""
502
+
503
+
i=0
504
+
505
+
n=a.shape[0]
506
+
m=b.shape[0]
507
+
508
+
# Next 3 lines equivalent to K= np.exp(-M/reg), but faster to compute
0 commit comments