Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d121bf8

Browse files
[MRG] Update doc and exemples (#754)
* update readme * big reoganization of exmaples * documenttaion withe xmaple in multiple sections * add all chnages * add all chnages * add bure bary to gaussian section * other example * fix readme links * update readme * change coot imahe
1 parent d2ea084 commit d121bf8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+340
-257
lines changed

‎CONTRIBUTORS.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ It is currently maintained by :
1212

1313
## Contributors
1414

15+
<a href="https://github.com/PythonOT/POT/graphs/contributors">
16+
<img src="https://contrib.rocks/image?repo=PythonOT/POT" />
17+
</a>
18+
19+
1520
The contributors to this library are:
1621

1722
* [Rémi Flamary](http://remi.flamary.com/) (EMD wrapper, Pytorch backend, DA
@@ -54,6 +59,7 @@ The contributors to this library are:
5459
* [Julie Delon](https://judelo.github.io/) (GMM OT)
5560
* [Samuel Boïté](https://samuelbx.github.io/) (GMM OT)
5661

62+
5763
## Acknowledgments
5864

5965
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):

‎README.md‎

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,36 @@ learning.
1414

1515
Website and documentation: [https://PythonOT.github.io/](https://PythonOT.github.io/)
1616

17-
Source Code (MIT): [https://github.com/PythonOT/POT](https://github.com/PythonOT/POT)
17+
Source Code (MIT):
18+
[https://github.com/PythonOT/POT](https://github.com/PythonOT/POT)
1819

19-
POT provides the following generic OT solvers (links to examples):
20+
21+
POT has the following main features:
22+
* A large set of differentiable solvers for optimal transport problems, including:
23+
* Exact linear OT, entropic and quadratic regularized OT,
24+
* Gromov-Wasserstein (GW) distances, Fused GW distances and variants of
25+
quadratic OT,
26+
* Unbalanced and partial OT for different divergences,
27+
* OT barycenters (Wasserstein and GW) for fixed and free support,
28+
* Fast OT solvers in 1D, on the circle and between Gaussian Mixture Models (GMMs),
29+
* Many ML related solvers, such as domain adaptation, optimal transport mapping
30+
estimation, subspace learning, Graph Neural Networks (GNNs) layers.
31+
* Several backends for easy use with Pytorch, Jax, Tensorflow, Numpy and Cupy arrays.
32+
33+
### Implemented Features
34+
35+
POT provides the following generic OT solvers:
2036

2137
* [OT Network Simplex solver](https://pythonot.github.io/auto_examples/plot_OT_1D.html) for the linear program/ Earth Movers Distance [1] .
2238
* [Conditional gradient](https://pythonot.github.io/auto_examples/plot_optim_OTreg.html) [6] and [Generalized conditional gradient](https://pythonot.github.io/auto_examples/plot_optim_OTreg.html) for regularized OT [7].
2339
* Entropic regularization OT solver with [Sinkhorn Knopp
2440
Algorithm](https://pythonot.github.io/auto_examples/plot_OT_1D.html) [2] ,
25-
stabilized version [9] [10] [34], lazy CPU/GPU solver from geomloss [60] [61], greedy Sinkhorn [22] and [Screening
26-
Sinkhorn [26]
27-
](https://pythonot.github.io/auto_examples/plot_screenkhorn_1D.html).
41+
stabilized version [9] [10] [34], lazy CPU/GPU solver from geomloss [60] [61], greedy Sinkhorn [22] and Screening
42+
Sinkhorn [26].
2843
* Bregman projections for [Wasserstein barycenter](https://pythonot.github.io/auto_examples/barycenters/plot_barycenter_lp_vs_entropic.html) [3], [convolutional barycenter](https://pythonot.github.io/auto_examples/barycenters/plot_convolutional_barycenter.html) [21] and unmixing [4].
2944
* Sinkhorn divergence [23] and entropic regularization OT from empirical data.
3045
* Debiased Sinkhorn barycenters [Sinkhorn divergence barycenter](https://pythonot.github.io/auto_examples/barycenters/plot_debiased_barycenter.html) [37]
31-
* [Smooth optimal transport solvers](https://pythonot.github.io/auto_examples/plot_OT_1D_smooth.html) (dual and semi-dual) for KL and squared L2 regularizations [17].
46+
* Smooth optimal transport solvers (dual and semi-dual) for KL and squared L2 regularizations [17].
3247
* Weak OT solver between empirical distributions [39]
3348
* Non regularized [Wasserstein barycenters [16] ](https://pythonot.github.io/auto_examples/barycenters/plot_barycenter_lp_vs_entropic.html) with LP solver (only small scale).
3449
* [Gromov-Wasserstein distances](https://pythonot.github.io/auto_examples/gromov/plot_gromov.html) and [GW barycenters](https://pythonot.github.io/auto_examples/gromov/plot_gromov_barycenter.html) (exact [13] and regularized [12,51]), differentiable using gradients from Graph Dictionary Learning [38]
@@ -42,15 +57,16 @@ POT provides the following generic OT solvers (links to examples):
4257
* [One dimensional Unbalanced OT](https://pythonot.github.io/auto_examples/unbalanced-partial/plot_UOT_1D.html) with KL relaxation and [barycenter](https://pythonot.github.io/auto_examples/unbalanced-partial/plot_UOT_barycenter_1D.html) [10, 25]. Also [exact unbalanced OT](https://pythonot.github.io/auto_examples/unbalanced-partial/plot_unbalanced_ot.html) with KL and quadratic regularization and the [regularization path of UOT](https://pythonot.github.io/auto_examples/unbalanced-partial/plot_regpath.html) [41]
4358
* [Partial Wasserstein and Gromov-Wasserstein](https://pythonot.github.io/auto_examples/unbalanced-partial/plot_partial_wass_and_gromov.html) and [Partial Fused Gromov-Wasserstein](https://pythonot.github.io/auto_examples/gromov/plot_partial_fgw.html) (exact [29] and entropic [3] formulations).
4459
* [Sliced Wasserstein](https://pythonot.github.io/auto_examples/sliced-wasserstein/plot_variance.html) [31, 32] and Max-sliced Wasserstein [35] that can be used for gradient flows [36].
45-
* [Wasserstein distance on the circle](https://pythonot.github.io/auto_examples/plot_compute_wasserstein_circle.html) [44, 45]
46-
* [Spherical Sliced Wasserstein](https://pythonot.github.io/auto_examples/sliced-wasserstein/plot_variance_ssw.html) [46]
60+
* [Wasserstein distance on the
61+
circle](https://pythonot.github.io/auto_examples/sliced-wasserstein/plot_compute_wasserstein_circle.html)
62+
[44, 45] and [Spherical Sliced Wasserstein](https://pythonot.github.io/auto_examples/sliced-wasserstein/plot_variance_ssw.html) [46]
4763
* [Graph Dictionary Learning solvers](https://pythonot.github.io/auto_examples/gromov/plot_gromov_wasserstein_dictionary_learning.html) [38].
4864
* [Semi-relaxed (Fused) Gromov-Wasserstein divergences](https://pythonot.github.io/auto_examples/gromov/plot_semirelaxed_fgw.html) with corresponding [barycenter solvers](https://pythonot.github.io/auto_examples/gromov/plot_semirelaxed_gromov_wasserstein_barycenter.hmtl) (exact and regularized [48]).
4965
* [Quantized (Fused) Gromov-Wasserstein distances](https://pythonot.github.io/auto_examples/gromov/plot_quantized_gromov_wasserstein.html) [68].
5066
* [Efficient Discrete Multi Marginal Optimal Transport Regularization](https://pythonot.github.io/auto_examples/others/plot_demd_gradient_minimize.html) [50].
5167
* [Several backends](https://pythonot.github.io/quickstart.html#solving-ot-with-multiple-backends) for easy use of POT with [Pytorch](https://pytorch.org/)/[jax](https://github.com/google/jax)/[Numpy](https://numpy.org/)/[Cupy](https://cupy.dev/)/[Tensorflow](https://www.tensorflow.org/) arrays.
5268
* [Smooth Strongly Convex Nearest Brenier Potentials](https://pythonot.github.io/auto_examples/others/plot_SSNB.html#sphx-glr-auto-examples-others-plot-ssnb-py) [58], with an extension to bounding potentials using [59].
53-
* [Gaussian Mixture Model OT](https://pythonot.github.io/auto_examples/others/plot_GMMOT_plan.html#sphx-glr-auto-examples-others-plot-gmmot-plan-py) [69].
69+
* [Gaussian Mixture Model OT](https://pythonot.github.io/auto_examples/gaussian_gmm/plot_GMMOT_plan.html#sphx-glr-auto-examples-others-plot-gmmot-plan-py) [69].
5470
* [Co-Optimal Transport](https://pythonot.github.io/auto_examples/others/plot_COOT.html) [49] and
5571
[unbalanced Co-Optimal Transport](https://pythonot.github.io/auto_examples/others/plot_learning_weights_with_COOT.html) [71].
5672
* Fused unbalanced Gromov-Wasserstein [70].
@@ -173,6 +189,12 @@ import ot
173189
```python
174190
# a,b are 1D histograms (sum to 1 and positive)
175191
# M is the ground cost matrix
192+
193+
# With the unified API :
194+
Wd = ot.solve(M, a, b).value # exact linear program
195+
Wd_reg = ot.solve(M, a, b, reg=reg).value # entropic regularized OT
196+
197+
# With the old API :
176198
Wd = ot.emd2(a, b, M) # exact linear program
177199
Wd_reg = ot.sinkhorn2(a, b, M, reg) # entropic regularized OT
178200
# if b is a matrix compute all distances to a and return a vector
@@ -183,10 +205,29 @@ Wd_reg = ot.sinkhorn2(a, b, M, reg) # entropic regularized OT
183205
```python
184206
# a,b are 1D histograms (sum to 1 and positive)
185207
# M is the ground cost matrix
208+
209+
# With the unified API :
210+
T = ot.solve(M, a, b).plan # exact linear program
211+
T_reg = ot.solve(M, a, b, reg=reg).plan # entropic regularized OT
212+
213+
# With the old API :
186214
T = ot.emd(a, b, M) # exact linear program
187215
T_reg = ot.sinkhorn(a, b, M, reg) # entropic regularized OT
188216
```
189217

218+
* Compute OT on empirical distributions
219+
220+
```python
221+
# X and Y are two 2D arrays of shape (n_samples, n_features)
222+
223+
# with squared euclidean metric
224+
T = ot.solve_sample(X, Y).plan # exact linear program
225+
T_reg = ot.solve_sample(X, Y, reg=reg).plan # entropic regularized OT
226+
227+
Wass_2 = ot.solve_sample(X, Y).value # Squared Wasserstein_2
228+
Wass_1 = ot.solve_sample(X, Y, metric='euclidean').value # Wasserstein 1
229+
```
230+
190231
* Compute Wasserstein barycenter
191232

192233
```python
@@ -209,7 +250,11 @@ It is currently maintained by :
209250
* [Rémi Flamary](https://remi.flamary.com/)
210251
* [Cédric Vincent-Cuaz](https://cedricvincentcuaz.github.io/)
211252

212-
The numerous contributors to this library are listed [here](CONTRIBUTORS.md).
253+
The POT contributors to this library are listed [here](CONTRIBUTORS.md).
254+
255+
<a href="https://github.com/PythonOT/POT/graphs/contributors">
256+
<img src="https://contrib.rocks/image?repo=PythonOT/POT" />
257+
</a>
213258

214259
POT has benefited from the financing or manpower from the following partners:
215260

‎RELEASES.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- Fix reg_div function compatibility with numpy in `ot.unbalanced.lbfgsb_unbalanced` via new function `ot.utils.fun_to_numpy` (PR #731)
2222
- Added to each example in the examples gallery the information about the release version in which it was introduced (PR #743)
2323
- Removed release information from quickstart guide (PR #744)
24+
- Update REAMDE with new API and reorganize examples (PR #754)
2425

2526
#### Closed issues
2627
- Fixed `ot.mapping` solvers which depended on deprecated `cvxpy` `ECOS` solver (PR #692, Issue #668)

‎docs/source/conf.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import sys
1616
import os
1717
import re
18-
18+
importdatetime
1919

2020
# !!!! allow readthedoc compilation
2121
try:
@@ -90,7 +90,7 @@ def __getattr__(cls, name):
9090

9191
# General information about the project.
9292
project = "POT Python Optimal Transport"
93-
copyright = "2016-2023, POT Contributors"
93+
copyright = "2016-{}, POT Contributors".format(datetime.datetime.now().year)
9494
author = "Rémi Flamary, POT Contributors"
9595

9696
# The version info for the project you're documenting, acts as replacement for
@@ -356,4 +356,5 @@ def __getattr__(cls, name):
356356
"doc_module": ("ot", "numpy", "scipy", "pylab"),
357357
"matplotlib_animations": True,
358358
"reference_url": {"ot": None},
359+
"copyfile_regex": r"index.rst",
359360
}

‎examples/README.txt‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎examples/backends/README.txt‎

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎examples/backends/index.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
3+
Differentiable OT with PyTorch
4+
------------------------------
File renamed without changes.

‎examples/barycenters/plot_free_support_sinkhorn_barycenter.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#
1616
# License: MIT License
1717

18+
# sphinx_gallery_thumbnail_number = 2
19+
1820
import numpy as np
1921
import matplotlib.pyplot as plt
2022
import ot
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

22

33

4-
Domain adaptation examples
4+
Domain adaptation with OT
55
--------------------------

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /