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
Copy file name to clipboardExpand all lines: README.md
+36-4Lines changed: 36 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -72,9 +72,42 @@ obviously you need CUDA installed and a compatible GPU.
72
72
73
73
## Examples
74
74
75
-
The examples folder contain several examples and use case for the library. The full documentation is available on [Readthedocs](http://pot.readthedocs.io/)
75
+
### Short examples
76
76
77
-
Here is a list of the Python notebooks if you want a quick look:
77
+
* Import the toolbox
78
+
```python
79
+
import ot
80
+
```
81
+
* Compute Wasserstein distances
82
+
```python
83
+
# a,b are 1D histograms (sum to 1 and positive)
84
+
# M is the ground cost matrix
85
+
Wd=ot.emd2(a,b,M) # exact linear program
86
+
# if b is a matrix compute all distances to a and return a vector
87
+
```
88
+
* Compute OT matrix
89
+
```python
90
+
# a,b are 1D histograms (sum to 1 and positive)
91
+
# M is the ground cost matrix
92
+
Totp=ot.emd(a,b,M) # exact linear program
93
+
Totp_reg=ot.sinkhorn(a,b,M,reg) # entropic regularized OT
94
+
```
95
+
* Compute Wasserstein barycenter
96
+
```python
97
+
# A is a n*d matrix containing d 1D histograms
98
+
# M is the ground cost matrix
99
+
ba=ot.barycenter(A,M,reg) # reg is regularization parameter
100
+
```
101
+
102
+
103
+
104
+
105
+
### Examples and Notebooks
106
+
107
+
The examples folder contain several examples and use case for the library. The full documentation is available on [Readthedocs](http://pot.readthedocs.io/).
108
+
109
+
110
+
Here is a list of the Python notebooks available [here](https://github.com/rflamary/POT/blob/master/notebooks/) if you want a quick look:
0 commit comments