@@ -58,27 +58,6 @@ def coordinate_grad_semi_dual(b, M, reg, beta, i):
58
58
-------
59
59
coordinate gradient : ndarray, shape (nt,)
60
60
61
- Examples
62
- --------
63
- >>> import ot
64
- >>> np.random.seed(0)
65
- >>> n_source = 7
66
- >>> n_target = 4
67
- >>> a = ot.utils.unif(n_source)
68
- >>> b = ot.utils.unif(n_target)
69
- >>> X_source = np.random.randn(n_source, 2)
70
- >>> Y_target = np.random.randn(n_target, 2)
71
- >>> M = ot.dist(X_source, Y_target)
72
- >>> ot.stochastic.solve_semi_dual_entropic(a, b, M, reg=1, method="ASGD", numItermax=300000)
73
- array([[2.53942342e-02, 9.98640673e-02, 1.75945647e-02, 4.27664307e-06],
74
- [1.21556999e-01, 1.26350515e-02, 1.30491795e-03, 7.36017394e-03],
75
- [3.54070702e-03, 7.63581358e-02, 6.29581672e-02, 1.32812798e-07],
76
- [2.60578198e-02, 3.35916645e-02, 8.28023223e-02, 4.05336238e-04],
77
- [9.86808864e-03, 7.59774324e-04, 1.08702729e-02, 1.21359007e-01],
78
- [2.17218856e-02, 9.12931802e-04, 1.87962526e-03, 1.18342700e-01],
79
- [4.14237512e-02, 2.67487857e-02, 7.23016955e-02, 2.38291052e-03]])
80
-
81
-
82
61
.. _references-coordinate-grad-semi-dual:
83
62
References
84
63
----------
@@ -137,27 +116,6 @@ def sag_entropic_transport(a, b, M, reg, numItermax=10000, lr=None):
137
116
v : ndarray, shape (`nt`,)
138
117
Dual variable.
139
118
140
- Examples
141
- --------
142
- >>> import ot
143
- >>> np.random.seed(0)
144
- >>> n_source = 7
145
- >>> n_target = 4
146
- >>> a = ot.utils.unif(n_source)
147
- >>> b = ot.utils.unif(n_target)
148
- >>> X_source = np.random.randn(n_source, 2)
149
- >>> Y_target = np.random.randn(n_target, 2)
150
- >>> M = ot.dist(X_source, Y_target)
151
- >>> ot.stochastic.solve_semi_dual_entropic(a, b, M, reg=1, method="ASGD", numItermax=300000)
152
- array([[2.53942342e-02, 9.98640673e-02, 1.75945647e-02, 4.27664307e-06],
153
- [1.21556999e-01, 1.26350515e-02, 1.30491795e-03, 7.36017394e-03],
154
- [3.54070702e-03, 7.63581358e-02, 6.29581672e-02, 1.32812798e-07],
155
- [2.60578198e-02, 3.35916645e-02, 8.28023223e-02, 4.05336238e-04],
156
- [9.86808864e-03, 7.59774324e-04, 1.08702729e-02, 1.21359007e-01],
157
- [2.17218856e-02, 9.12931802e-04, 1.87962526e-03, 1.18342700e-01],
158
- [4.14237512e-02, 2.67487857e-02, 7.23016955e-02, 2.38291052e-03]])
159
-
160
-
161
119
.. _references-sag-entropic-transport:
162
120
References
163
121
----------
@@ -225,27 +183,6 @@ def averaged_sgd_entropic_transport(a, b, M, reg, numItermax=300000, lr=None):
225
183
ave_v : ndarray, shape (`nt`,)
226
184
dual variable
227
185
228
- Examples
229
- --------
230
- >>> import ot
231
- >>> np.random.seed(0)
232
- >>> n_source = 7
233
- >>> n_target = 4
234
- >>> a = ot.utils.unif(n_source)
235
- >>> b = ot.utils.unif(n_target)
236
- >>> X_source = np.random.randn(n_source, 2)
237
- >>> Y_target = np.random.randn(n_target, 2)
238
- >>> M = ot.dist(X_source, Y_target)
239
- >>> ot.stochastic.solve_semi_dual_entropic(a, b, M, reg=1, method="ASGD", numItermax=300000)
240
- array([[2.53942342e-02, 9.98640673e-02, 1.75945647e-02, 4.27664307e-06],
241
- [1.21556999e-01, 1.26350515e-02, 1.30491795e-03, 7.36017394e-03],
242
- [3.54070702e-03, 7.63581358e-02, 6.29581672e-02, 1.32812798e-07],
243
- [2.60578198e-02, 3.35916645e-02, 8.28023223e-02, 4.05336238e-04],
244
- [9.86808864e-03, 7.59774324e-04, 1.08702729e-02, 1.21359007e-01],
245
- [2.17218856e-02, 9.12931802e-04, 1.87962526e-03, 1.18342700e-01],
246
- [4.14237512e-02, 2.67487857e-02, 7.23016955e-02, 2.38291052e-03]])
247
-
248
-
249
186
.. _references-averaged-sgd-entropic-transport:
250
187
References
251
188
----------
@@ -304,27 +241,6 @@ def c_transform_entropic(b, M, reg, beta):
304
241
u : ndarray, shape (`ns`,)
305
242
Dual variable.
306
243
307
- Examples
308
- --------
309
- >>> import ot
310
- >>> np.random.seed(0)
311
- >>> n_source = 7
312
- >>> n_target = 4
313
- >>> a = ot.utils.unif(n_source)
314
- >>> b = ot.utils.unif(n_target)
315
- >>> X_source = np.random.randn(n_source, 2)
316
- >>> Y_target = np.random.randn(n_target, 2)
317
- >>> M = ot.dist(X_source, Y_target)
318
- >>> ot.stochastic.solve_semi_dual_entropic(a, b, M, reg=1, method="ASGD", numItermax=300000)
319
- array([[2.53942342e-02, 9.98640673e-02, 1.75945647e-02, 4.27664307e-06],
320
- [1.21556999e-01, 1.26350515e-02, 1.30491795e-03, 7.36017394e-03],
321
- [3.54070702e-03, 7.63581358e-02, 6.29581672e-02, 1.32812798e-07],
322
- [2.60578198e-02, 3.35916645e-02, 8.28023223e-02, 4.05336238e-04],
323
- [9.86808864e-03, 7.59774324e-04, 1.08702729e-02, 1.21359007e-01],
324
- [2.17218856e-02, 9.12931802e-04, 1.87962526e-03, 1.18342700e-01],
325
- [4.14237512e-02, 2.67487857e-02, 7.23016955e-02, 2.38291052e-03]])
326
-
327
-
328
244
.. _references-c-transform-entropic:
329
245
References
330
246
----------
@@ -399,27 +315,6 @@ def solve_semi_dual_entropic(a, b, M, reg, method, numItermax=10000, lr=None,
399
315
log : dict
400
316
log dictionary return only if log==True in parameters
401
317
402
- Examples
403
- --------
404
- >>> import ot
405
- >>> np.random.seed(0)
406
- >>> n_source = 7
407
- >>> n_target = 4
408
- >>> a = ot.utils.unif(n_source)
409
- >>> b = ot.utils.unif(n_target)
410
- >>> X_source = np.random.randn(n_source, 2)
411
- >>> Y_target = np.random.randn(n_target, 2)
412
- >>> M = ot.dist(X_source, Y_target)
413
- >>> ot.stochastic.solve_semi_dual_entropic(a, b, M, reg=1, method="ASGD", numItermax=300000)
414
- array([[2.53942342e-02, 9.98640673e-02, 1.75945647e-02, 4.27664307e-06],
415
- [1.21556999e-01, 1.26350515e-02, 1.30491795e-03, 7.36017394e-03],
416
- [3.54070702e-03, 7.63581358e-02, 6.29581672e-02, 1.32812798e-07],
417
- [2.60578198e-02, 3.35916645e-02, 8.28023223e-02, 4.05336238e-04],
418
- [9.86808864e-03, 7.59774324e-04, 1.08702729e-02, 1.21359007e-01],
419
- [2.17218856e-02, 9.12931802e-04, 1.87962526e-03, 1.18342700e-01],
420
- [4.14237512e-02, 2.67487857e-02, 7.23016955e-02, 2.38291052e-03]])
421
-
422
-
423
318
.. _references-solve-semi-dual-entropic:
424
319
References
425
320
----------
@@ -509,33 +404,6 @@ def batch_grad_dual(a, b, M, reg, alpha, beta, batch_size, batch_alpha,
509
404
grad : ndarray, shape (`ns`,)
510
405
partial grad F
511
406
512
- Examples
513
- --------
514
- >>> import ot
515
- >>> np.random.seed(0)
516
- >>> n_source = 7
517
- >>> n_target = 4
518
- >>> a = ot.utils.unif(n_source)
519
- >>> b = ot.utils.unif(n_target)
520
- >>> X_source = np.random.randn(n_source, 2)
521
- >>> Y_target = np.random.randn(n_target, 2)
522
- >>> M = ot.dist(X_source, Y_target)
523
- >>> sgd_dual_pi, log = ot.stochastic.solve_dual_entropic(a, b, M, reg=1, batch_size=3, numItermax=30000, lr=0.1, log=True)
524
- >>> log['alpha']
525
- array([0.71759102, 1.57057384, 0.85576566, 0.1208211 , 0.59190466,
526
- 1.197148 , 0.17805133])
527
- >>> log['beta']
528
- array([0.49741367, 0.57478564, 1.40075528, 2.75890102])
529
- >>> sgd_dual_pi
530
- array([[2.09730063e-02, 8.38169324e-02, 7.50365455e-03, 8.72731415e-09],
531
- [5.58432437e-03, 5.89881299e-04, 3.09558411e-05, 8.35469849e-07],
532
- [3.26489515e-03, 7.15536035e-02, 2.99778211e-02, 3.02601593e-10],
533
- [4.05390622e-02, 5.31085068e-02, 6.65191787e-02, 1.55812785e-06],
534
- [7.82299812e-02, 6.12099102e-03, 4.44989098e-02, 2.37719187e-03],
535
- [5.06266486e-02, 2.16230494e-03, 2.26215141e-03, 6.81514609e-04],
536
- [6.06713990e-02, 3.98139808e-02, 5.46829338e-02, 8.62371424e-06]])
537
-
538
-
539
407
.. _references-batch-grad-dual:
540
408
References
541
409
----------
@@ -600,37 +468,6 @@ def sgd_entropic_regularization(a, b, M, reg, batch_size, numItermax, lr):
600
468
beta : ndarray, shape (nt,)
601
469
dual variable
602
470
603
- Examples
604
- --------
605
- >>> import ot
606
- >>> n_source = 7
607
- >>> n_target = 4
608
- >>> reg = 1
609
- >>> numItermax = 20000
610
- >>> lr = 0.1
611
- >>> batch_size = 3
612
- >>> log = True
613
- >>> a = ot.utils.unif(n_source)
614
- >>> b = ot.utils.unif(n_target)
615
- >>> rng = np.random.RandomState(0)
616
- >>> X_source = rng.randn(n_source, 2)
617
- >>> Y_target = rng.randn(n_target, 2)
618
- >>> M = ot.dist(X_source, Y_target)
619
- >>> sgd_dual_pi, log = ot.stochastic.solve_dual_entropic(a, b, M, reg, batch_size, numItermax, lr, log)
620
- >>> log['alpha']
621
- array([0.64171798, 1.27932201, 0.78132257, 0.15638935, 0.54888354,
622
- 1.03663469, 0.20595781])
623
- >>> log['beta']
624
- array([0.51207194, 0.58033189, 1.28922676, 2.26859736])
625
- >>> sgd_dual_pi
626
- array([[1.97276541e-02, 7.81248547e-02, 6.22136048e-03, 4.95442423e-09],
627
- [4.23494310e-03, 4.43286263e-04, 2.06927079e-05, 3.82389139e-07],
628
- [3.07542414e-03, 6.67897769e-02, 2.48904999e-02, 1.72030247e-10],
629
- [4.26271990e-02, 5.53375455e-02, 6.16535024e-02, 9.88812650e-07],
630
- [7.60423265e-02, 5.89585256e-03, 3.81267087e-02, 1.39458256e-03],
631
- [4.37557504e-02, 1.85189176e-03, 1.72335760e-03, 3.55491279e-04],
632
- [6.33096109e-02, 4.11683954e-02, 5.02962051e-02, 5.43097516e-06]])
633
-
634
471
References
635
472
----------
636
473
.. [19] Seguy, V., Bhushan Damodaran, B., Flamary, R., Courty, N., Rolet, A.& Blondel, M. Large-scale Optimal Transport and Mapping Estimation. International Conference on Learning Representation (2018)
@@ -702,37 +539,6 @@ def solve_dual_entropic(a, b, M, reg, batch_size, numItermax=10000, lr=1,
702
539
log : dict
703
540
log dictionary return only if log==True in parameters
704
541
705
- Examples
706
- --------
707
- >>> import ot
708
- >>> n_source = 7
709
- >>> n_target = 4
710
- >>> reg = 1
711
- >>> numItermax = 20000
712
- >>> lr = 0.1
713
- >>> batch_size = 3
714
- >>> log = True
715
- >>> a = ot.utils.unif(n_source)
716
- >>> b = ot.utils.unif(n_target)
717
- >>> rng = np.random.RandomState(0)
718
- >>> X_source = rng.randn(n_source, 2)
719
- >>> Y_target = rng.randn(n_target, 2)
720
- >>> M = ot.dist(X_source, Y_target)
721
- >>> sgd_dual_pi, log = ot.stochastic.solve_dual_entropic(a, b, M, reg, batch_size, numItermax, lr, log)
722
- >>> log['alpha']
723
- array([0.64057733, 1.2683513 , 0.75610161, 0.16024284, 0.54926534,
724
- 1.0514201 , 0.19958936])
725
- >>> log['beta']
726
- array([0.51372571, 0.58843489, 1.27993921, 2.24344807])
727
- >>> sgd_dual_pi
728
- array([[1.97377795e-02, 7.86706853e-02, 6.15682001e-03, 4.82586997e-09],
729
- [4.19566963e-03, 4.42016865e-04, 2.02777272e-05, 3.68823708e-07],
730
- [3.00379244e-03, 6.56562018e-02, 2.40462171e-02, 1.63579656e-10],
731
- [4.28626062e-02, 5.60031599e-02, 6.13193826e-02, 9.67977735e-07],
732
- [7.61972739e-02, 5.94609051e-03, 3.77886693e-02, 1.36046648e-03],
733
- [4.44810042e-02, 1.89476742e-03, 1.73285847e-03, 3.51826036e-04],
734
- [6.30118293e-02, 4.12398660e-02, 4.95148998e-02, 5.26247246e-06]])
735
-
736
542
References
737
543
----------
738
544
.. [19] Seguy, V., Bhushan Damodaran, B., Flamary, R., Courty, N., Rolet, A.& Blondel, M. Large-scale Optimal Transport and Mapping Estimation. International Conference on Learning Representation (2018)
0 commit comments