Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2b317e2

Browse files
authoredJan 27, 2025
Merge branch 'master' into bwgd_barycenter
2 parents 5da317f + c128104 commit 2b317e2

19 files changed

+1201
-1149
lines changed
 

‎CONTRIBUTORS.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The contributors to this library are:
4848
* [Camille Le Coz](https://www.linkedin.com/in/camille-le-coz-8593b91a1/) (EMD2 debug)
4949
* [Eduardo Fernandes Montesuma](https://eddardd.github.io/my-personal-blog/) (Free support sinkhorn barycenter)
5050
* [Theo Gnassounou](https://github.com/tgnassou) (OT between Gaussian distributions)
51-
* [Clément Bonet](https://clbonet.github.io) (Wassertstein on circle, Spherical Sliced-Wasserstein)
51+
* [Clément Bonet](https://clbonet.github.io) (Wasserstein on circle, Spherical Sliced-Wasserstein)
5252
* [Ronak Mehta](https://ronakrm.github.io) (Efficient Discrete Multi Marginal Optimal Transport Regularization)
5353
* [Xizheng Yu](https://github.com/x12hengyu) (Efficient Discrete Multi Marginal Optimal Transport Regularization)
5454
* [Sonia Mazelet](https://github.com/SoniaMaz8) (Template based GNN layers)

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ POT provides the following generic OT solvers (links to examples):
5151
* [Efficient Discrete Multi Marginal Optimal Transport Regularization](https://pythonot.github.io/auto_examples/others/plot_demd_gradient_minimize.html) [50].
5252
* [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.
5353
* [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].
54-
* Gaussian Mixture Model OT [69]
54+
* [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].
5555
* [Co-Optimal Transport](https://pythonot.github.io/auto_examples/others/plot_COOT.html) [49] and
5656
[unbalanced Co-Optimal Transport](https://pythonot.github.io/auto_examples/others/plot_learning_weights_with_COOT.html) [71].
5757
* Fused unbalanced Gromov-Wasserstein [70].

‎RELEASES.md

+3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
- Implement CG solvers for partial FGW (PR #687)
77
- Added feature `grad=last_step` for `ot.solvers.solve` (PR #693)
88
- Automatic PR labeling and release file update check (PR #704)
9+
- Reorganize sub-module `ot/lp/__init__.py` into separate files (PR #714)
10+
- Fix documentation in the module `ot.gaussian` (PR #718)
911

1012
#### Closed issues
1113
- Fixed `ot.mapping` solvers which depended on deprecated `cvxpy` `ECOS` solver (PR #692, Issue #668)
1214
- Fixed numerical errors in `ot.gmm` (PR #690, Issue #689)
1315
- Add version number to the documentation (PR #696)
1416
- Update doc for default regularization in `ot.unbalanced` sinkhorn solvers (Issue #691, PR #700)
17+
- Clean documentation for `gromov`, `lp` and `unbalanced` folders (PR #710)
1518

1619
## 0.9.5
1720

‎ot/gaussian.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ def empirical_bures_wasserstein_barycenter(
694694
695695
The function estimates the optimal barycenter of the
696696
empirical distributions. This is equivalent to resolving the fixed point
697-
algorithm for multiple Gaussian distributions :math:`\left{\mathcal{N}(\mu,\Sigma)\right}_{i=1}^n`
697+
algorithm for multiple Gaussian distributions :math:`\left\{\mathcal{N}(\mu,\Sigma)\right\}_{i=1}^n`
698698
:ref:`[1] <references-OT-mapping-linear-barycenter>`.
699699
700700
The barycenter still following a Gaussian distribution :math:`\mathcal{N}(\mu_b,\Sigma_b)`

‎ot/gmm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from .backend import get_backend
1313
from .lp import emd2, emd
1414
import numpy as np
15-
from .lp import dist
15+
from .utils import dist
1616
from .gaussian import bures_wasserstein_mapping
1717

1818

‎ot/gromov/_lowrank.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ def lowrank_gromov_wasserstein_samples(
9292
9393
where :
9494
95-
- :math: `A` is the (`dim_a`, `dim_a`) square pairwise cost matrix of the source domain.
96-
- :math: `B` is the (`dim_a`, `dim_a`) square pairwise cost matrix of the target domain.
97-
- :math: `\mathcal{Q}_{A,B}` is quadratic objective function of the Gromov Wasserstein plan.
98-
- :math: `Q` and `R` are the low-rank matrix decomposition of the Gromov-Wasserstein plan.
99-
- :math: `g` is the weight vector for the low-rank decomposition of the Gromov-Wasserstein plan.
95+
- :math:`A` is the (`dim_a`, `dim_a`) square pairwise cost matrix of the source domain.
96+
- :math:`B` is the (`dim_a`, `dim_a`) square pairwise cost matrix of the target domain.
97+
- :math:`\mathcal{Q}_{A,B}` is quadratic objective function of the Gromov Wasserstein plan.
98+
- :math:`Q` and `R` are the low-rank matrix decomposition of the Gromov-Wasserstein plan.
99+
- :math:`g` is the weight vector for the low-rank decomposition of the Gromov-Wasserstein plan.
100100
- :math:`\mathbf{a}` and :math:`\mathbf{b}` are source and target weights (histograms, both sum to 1).
101-
- :math: `r` is the rank of the Gromov-Wasserstein plan.
102-
- :math: `\mathcal{C(a,b,r)}` are the low-rank couplings of the OT problem.
101+
- :math:`r` is the rank of the Gromov-Wasserstein plan.
102+
- :math:`\mathcal{C(a,b,r)}` are the low-rank couplings of the OT problem.
103103
- :math:`H((Q,R,g))` is the values of the three respective entropies evaluated for each term.
104104
105105

‎ot/gromov/_partial.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def partial_gromov_wasserstein(
185185
if m is None:
186186
m = min(np.sum(p), np.sum(q))
187187
elif m < 0:
188-
raise ValueError("Problem infeasible. Parameter m should be greater" " than 0.")
188+
raise ValueError("Problem infeasible. Parameter m should be greater than 0.")
189189
elif m > min(np.sum(p), np.sum(q)):
190190
raise ValueError(
191191
"Problem infeasible. Parameter m should lower or"
@@ -654,7 +654,7 @@ def partial_fused_gromov_wasserstein(
654654
if m is None:
655655
m = min(np.sum(p), np.sum(q))
656656
elif m < 0:
657-
raise ValueError("Problem infeasible. Parameter m should be greater" " than 0.")
657+
raise ValueError("Problem infeasible. Parameter m should be greater than 0.")
658658
elif m > min(np.sum(p), np.sum(q)):
659659
raise ValueError(
660660
"Problem infeasible. Parameter m should lower or"
@@ -1002,18 +1002,18 @@ def solve_partial_gromov_linesearch(
10021002
Parameters
10031003
----------
10041004
1005-
G : array-like, shape(ns,nt)
1005+
G : array-like, shape(ns, nt)
10061006
The transport map at a given iteration of the FW
1007-
deltaG : array-like (ns,nt)
1007+
deltaG : array-like, shape (ns, nt)
10081008
Difference between the optimal map `Gc` found by linearization in the
10091009
FW algorithm and the value at a given iteration
10101010
cost_G : float
10111011
Value of the cost at `G`
1012-
df_G : array-like (ns,nt)
1012+
df_G : array-like, shape (ns, nt)
10131013
Gradient of the GW cost at `G`
1014-
df_Gc : array-like (ns,nt)
1014+
df_Gc : array-like, shape (ns, nt)
10151015
Gradient of the GW cost at `Gc`
1016-
M : array-like (ns,nt)
1016+
M : array-like, shape (ns, nt)
10171017
Cost matrix between the features.
10181018
reg : float
10191019
Regularization parameter.
@@ -1032,7 +1032,7 @@ def solve_partial_gromov_linesearch(
10321032
nb of function call. Useless here
10331033
cost_G : float
10341034
The value of the cost for the next iteration
1035-
df_G : array-like (ns,nt)
1035+
df_G : array-like, shape (ns, nt)
10361036
Updated gradient of the GW cost
10371037
10381038
References
@@ -1173,7 +1173,7 @@ def entropic_partial_gromov_wasserstein(
11731173
11741174
Returns
11751175
-------
1176-
:math: `gamma` : (dim_a, dim_b) ndarray
1176+
:math:`gamma` : ndarray, shape (dim_a, dim_b)
11771177
Optimal transportation matrix for the given parameters
11781178
log : dict
11791179
log dictionary returned only if `log` is `True`
@@ -1213,7 +1213,7 @@ def entropic_partial_gromov_wasserstein(
12131213
if m is None:
12141214
m = min(nx.sum(p), nx.sum(q))
12151215
elif m < 0:
1216-
raise ValueError("Problem infeasible. Parameter m should be greater" " than 0.")
1216+
raise ValueError("Problem infeasible. Parameter m should be greater than 0.")
12171217
elif m > min(nx.sum(p), nx.sum(q)):
12181218
raise ValueError(
12191219
"Problem infeasible. Parameter m should lower or"

‎ot/gromov/_quantized.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ def get_graph_partition(
375375
raise ValueError(
376376
f"""
377377
Unknown `part_method='{part_method}'`. Use one of:
378-
{'random', 'louvain', 'fluid', 'spectral', 'GW', 'FGW'}.
378+
{"random", "louvain", "fluid", "spectral", "GW", "FGW"}.
379379
"""
380380
)
381381
return nx.from_numpy(part, type_as=C0)
@@ -447,7 +447,7 @@ def get_graph_representants(C, part, rep_method="pagerank", random_state=0, nx=N
447447
raise ValueError(
448448
f"""
449449
Unknown `rep_method='{rep_method}'`. Use one of:
450-
{'random', 'pagerank'}.
450+
{"random", "pagerank"}.
451451
"""
452452
)
453453

@@ -953,7 +953,7 @@ def get_partition_and_representants_samples(
953953
else:
954954
raise ValueError(
955955
f"""
956-
Unknown `method='{method}'`. Use one of: {'random', 'kmeans'}
956+
Unknown `method='{method}'`. Use one of: {"random", "kmeans"}
957957
"""
958958
)
959959

0 commit comments

Comments
 (0)
Please sign in to comment.