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
This toolbox benefit a lot from open source research and we would like to thank the following persons for providing some code (in various languages):
166
167
@@ -226,3 +227,5 @@ You can also post bug reports and feature requests in Github issues. Make sure t
226
227
[20] Cuturi, M. and Doucet, A. (2014) [Fast Computation of Wasserstein Barycenters](http://proceedings.mlr.press/v32/cuturi14.html). International Conference in Machine Learning
227
228
228
229
[21] Solomon, J., De Goes, F., Peyré, G., Cuturi, M., Butscher, A., Nguyen, A. & Guibas, L. (2015). [Convolutional wasserstein distances: Efficient optimal transportation on geometric domains](https://dl.acm.org/citation.cfm?id=2766963). ACM Transactions on Graphics (TOG), 34(4), 66.
230
+
231
+
[22] J. Altschuler, J.Weed, P. Rigollet, (2017) [Near-linear time approximation algorithms for optimal transport via Sinkhorn iteration](https://papers.nips.cc/paper/6792-near-linear-time-approximation-algorithms-for-optimal-transport-via-sinkhorn-iteration.pdf), Advances in Neural Information Processing Systems (NIPS) 31
.. [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})`
446
+
- a and b are source and target weights (sum to 1)
447
+
448
+
449
+
450
+
Parameters
451
+
----------
452
+
a : np.ndarray (ns,)
453
+
samples weights in the source domain
454
+
b : np.ndarray (nt,) or np.ndarray (nt,nbb)
455
+
samples in the target domain, compute sinkhorn with multiple targets
456
+
and fixed M if b is a matrix (return OT loss + dual variables in log)
457
+
M : np.ndarray (ns,nt)
458
+
loss matrix
459
+
reg : float
460
+
Regularization term >0
461
+
numItermax : int, optional
462
+
Max number of iterations
463
+
stopThr : float, optional
464
+
Stop threshol on error (>0)
465
+
log : bool, optional
466
+
record log if True
467
+
468
+
469
+
Returns
470
+
-------
471
+
gamma : (ns x nt) ndarray
472
+
Optimal transportation matrix for the given parameters
473
+
log : dict
474
+
log dictionary return only if log==True in parameters
475
+
476
+
Examples
477
+
--------
478
+
479
+
>>> import ot
480
+
>>> a=[.5,.5]
481
+
>>> b=[.5,.5]
482
+
>>> M=[[0.,1.],[1.,0.]]
483
+
>>> ot.bregman.greenkhorn(a,b,M,1)
484
+
array([[ 0.36552929, 0.13447071],
485
+
[ 0.13447071, 0.36552929]])
486
+
487
+
488
+
References
489
+
----------
490
+
491
+
.. [2] M. Cuturi, Sinkhorn Distances : Lightspeed Computation of Optimal Transport, Advances in Neural Information Processing Systems (NIPS) 26, 2013
492
+
[22] 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
493
+
494
+
495
+
See Also
496
+
--------
497
+
ot.lp.emd : Unregularized OT
498
+
ot.optim.cg : General regularized OT
499
+
500
+
"""
501
+
502
+
n=a.shape[0]
503
+
m=b.shape[0]
504
+
505
+
# Next 3 lines equivalent to K= np.exp(-M/reg), but faster to compute
0 commit comments