Skip to content

Commit 29276ad

Browse files
[DOC] Improve documentation rendering (#787)
* improve documentation rendering * complete releases file --------- Co-authored-by: Rémi Flamary <remi.flamary@gmail.com>
1 parent 82b4f31 commit 29276ad

File tree

14 files changed

+58
-46
lines changed

14 files changed

+58
-46
lines changed

RELEASES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ This new release adds support for sparse cost matrices and a new lazy EMD solver
1111
- Add support for sparse cost matrices in EMD solver (PR #778, Issue #397)
1212

1313
#### Closed issues
14+
1415
- Fix NumPy 2.x compatibility in Brenier potential bounds (PR #788)
1516
- Fix MSVC Windows build by removing __restrict__ keyword (PR #788)
1617
- Fix O(n³) performance bottleneck in sparse bipartite graph arc iteration (PR #785)
1718
- Fix deprecated JAX function in `ot.backend.JaxBackend` (PR #771, Issue #770)
1819
- Add test for build from source (PR #772, Issue #764)
1920
- Fix device for batch Ot solver in `ot.batch` (PR #784, Issue #783)
2021
- Fix openmp flags on macOS (PR #789)
22+
- Clean documentation (PR #787)
23+
2124

2225
## 0.9.6.post1
2326

docs/source/user_guide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ alignment between two distributions can be expressed as the one minimizing:
832832
833833
s.t. \gamma 1 = a; \gamma^T 1= b; \gamma\geq 0
834834
835-
where ::math:`C1` is the distance matrix between samples in the source
835+
where :math:`C1` is the distance matrix between samples in the source
836836
distribution and :math:`C2` the one between samples in the target,
837837
:math:`L(C1_{i,k},C2_{j,l})` is a measure of similarity between
838838
:math:`C1_{i,k}` and :math:`C2_{j,l}` often chosen as

ot/bregman/_geomloss.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def empirical_sinkhorn2_geomloss(
125125
The algorithm used for solving the problem is the Sinkhorn-Knopp matrix
126126
scaling algorithm as proposed in and computed in log space for
127127
better stability and epsilon-scaling. The solution is computed in a lazy way
128-
using the Geomloss [60] and the KeOps library [61].
128+
using the Geomloss [60]_ and the KeOps library [61]_.
129129
130130
Parameters
131131
----------

ot/coot.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,13 +412,14 @@ def co_optimal_transport2(
412412
warmstart : dictionary, optional (default = None)
413413
Contains 4 keys:
414414
- "duals_sample" and "duals_feature" whose values are
415-
tuples of 2 vectors of size (n_sample_x, n_sample_y) and (n_feature_x, n_feature_y).
416-
Initialization of sample and feature dual vectors
417-
if using Sinkhorn algorithm. Zero vectors by default.
415+
tuples of 2 vectors of size (n_sample_x, n_sample_y) and (n_feature_x, n_feature_y).
416+
Initialization of sample and feature dual vectors
417+
if using Sinkhorn algorithm. Zero vectors by default.
418+
418419
- "pi_sample" and "pi_feature" whose values are matrices
419-
of size (n_sample_x, n_sample_y) and (n_feature_x, n_feature_y).
420-
Initialization of sample and feature couplings.
421-
Uniform distributions by default.
420+
of size (n_sample_x, n_sample_y) and (n_feature_x, n_feature_y).
421+
Initialization of sample and feature couplings.
422+
Uniform distributions by default.
422423
nits_bcd : int, optional (default = 100)
423424
Number of Block Coordinate Descent (BCD) iterations to solve COOT.
424425
tol_bcd : float, optional (default = 1e-7)

ot/gromov/_bregman.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ def BAPG_gromov_wasserstein(
432432
\mathbf{T} &\geq 0
433433
434434
Else, the function solves an equivalent problem [63], where constant terms only
435-
depending on the marginals :math:`\mathbf{p}`: and :math:`\mathbf{q}`: are
435+
depending on the marginals :math:`\mathbf{p}` and :math:`\mathbf{q}` are
436436
discarded while assuming that L decomposes as in Proposition 1 in [12]:
437437
438438
.. math::
@@ -450,7 +450,7 @@ def BAPG_gromov_wasserstein(
450450
- :math:`\mathbf{p}`: distribution in the source space
451451
- :math:`\mathbf{q}`: distribution in the target space
452452
- `L`: loss function to account for the misfit between the similarity matrices
453-
satisfying :math:`L(a, b) = f_1(a) + f_2(b) - h_1(a) h_2(b)`
453+
satisfying :math:`L(a, b) = f_1(a) + f_2(b) - h_1(a) h_2(b)`
454454
455455
.. note:: By algorithmic design the optimal coupling :math:`\mathbf{T}`
456456
returned by this function does not necessarily satisfy the marginal
@@ -650,7 +650,7 @@ def BAPG_gromov_wasserstein2(
650650
\mathbf{T} &\geq 0
651651
652652
Else, the function solves an equivalent problem [63, 64], where constant terms only
653-
depending on the marginals :math:`\mathbf{p}`: and :math:`\mathbf{q}`: are
653+
depending on the marginals :math:`\mathbf{p}` and :math:`\mathbf{q}` are
654654
discarded while assuming that L decomposes as in Proposition 1 in [12]:
655655
656656
.. math::
@@ -668,7 +668,7 @@ def BAPG_gromov_wasserstein2(
668668
- :math:`\mathbf{p}`: distribution in the source space
669669
- :math:`\mathbf{q}`: distribution in the target space
670670
- `L`: loss function to account for the misfit between the similarity matrices
671-
satisfying :math:`L(a, b) = f_1(a) + f_2(b) - h_1(a) h_2(b)`
671+
satisfying :math:`L(a, b) = f_1(a) + f_2(b) - h_1(a) h_2(b)`
672672
673673
.. note:: By algorithmic design the optimal coupling :math:`\mathbf{T}`
674674
returned by this function does not necessarily satisfy the marginal
@@ -1439,12 +1439,13 @@ def BAPG_fused_gromov_wasserstein(
14391439
\mathbf{T} &\geq 0
14401440
14411441
Else, the function solves an equivalent problem [63, 64], where constant terms only
1442-
depending on the marginals :math:`\mathbf{p}`: and :math:`\mathbf{q}`: are
1442+
depending on the marginals :math:`\mathbf{p}` and :math:`\mathbf{q}` are
14431443
discarded while assuming that L decomposes as in Proposition 1 in [12]:
14441444
14451445
.. math::
14461446
\mathbf{T}^* \in\mathop{\arg\min}_\mathbf{T} \quad (1 - \alpha) \langle \mathbf{T}, \mathbf{M} \rangle_F -
14471447
\alpha \langle h_1(\mathbf{C}_1) \mathbf{T} h_2(\mathbf{C_2})^\top , \mathbf{T} \rangle_F
1448+
14481449
s.t. \ \mathbf{T} \mathbf{1} &= \mathbf{p}
14491450
14501451
\mathbf{T}^T \mathbf{1} &= \mathbf{q}
@@ -1459,7 +1460,7 @@ def BAPG_fused_gromov_wasserstein(
14591460
- :math:`\mathbf{p}`: distribution in the source space
14601461
- :math:`\mathbf{q}`: distribution in the target space
14611462
- `L`: loss function to account for the misfit between the similarity and feature matrices
1462-
satisfying :math:`L(a, b) = f_1(a) + f_2(b) - h_1(a) h_2(b)`
1463+
satisfying :math:`L(a, b) = f_1(a) + f_2(b) - h_1(a) h_2(b)`
14631464
- :math:`\alpha`: trade-off parameter
14641465
14651466
.. note:: By algorithmic design the optimal coupling :math:`\mathbf{T}`
@@ -1672,12 +1673,13 @@ def BAPG_fused_gromov_wasserstein2(
16721673
\mathbf{T} &\geq 0
16731674
16741675
Else, the function solves an equivalent problem [63, 64], where constant terms only
1675-
depending on the marginals :math:`\mathbf{p}`: and :math:`\mathbf{q}`: are
1676+
depending on the marginals :math:`\mathbf{p}` and :math:`\mathbf{q}` are
16761677
discarded while assuming that L decomposes as in Proposition 1 in [12]:
16771678
16781679
.. math::
16791680
\mathop{\min}_\mathbf{T} \quad (1 - \alpha) \langle \mathbf{T}, \mathbf{M} \rangle_F -
16801681
\alpha \langle h_1(\mathbf{C}_1) \mathbf{T} h_2(\mathbf{C_2})^\top , \mathbf{T} \rangle_F
1682+
16811683
s.t. \ \mathbf{T} \mathbf{1} &= \mathbf{p}
16821684
16831685
\mathbf{T}^T \mathbf{1} &= \mathbf{q}
@@ -1691,7 +1693,7 @@ def BAPG_fused_gromov_wasserstein2(
16911693
- :math:`\mathbf{p}`: distribution in the source space
16921694
- :math:`\mathbf{q}`: distribution in the target space
16931695
- `L`: loss function to account for the misfit between the similarity and feature matrices
1694-
satisfying :math:`L(a, b) = f_1(a) + f_2(b) - h_1(a) h_2(b)`
1696+
satisfying :math:`L(a, b) = f_1(a) + f_2(b) - h_1(a) h_2(b)`
16951697
- :math:`\alpha`: trade-off parameter
16961698
16971699
.. note:: By algorithmic design the optimal coupling :math:`\mathbf{T}`

ot/gromov/_quantized.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,8 @@ def format_partitioned_graph(
462462
with structure matrix :math:`(\mathbf{C} \in R^{n \times n}`, feature matrix
463463
:math:`(\mathbf{F} \in R^{n \times d}` and node relative importance
464464
:math:`(\mathbf{p} \in \Sigma_n`, into a partitioned attributed graph
465-
taking into account partitions and representants :math:`\mathcal{P} = \left{(\mathbf{P_{i}}, \mathbf{r_{i}})\right}_i`.
465+
taking into account partitions and representants
466+
:math:`\mathcal{P} = \left\{(\mathbf{P_{i}}, \mathbf{r_{i}})\right\}_i`.
466467
467468
Parameters
468469
----------
@@ -966,7 +967,8 @@ def format_partitioned_samples(X, p, part, rep_indices, F=None, alpha=1.0, nx=No
966967
with euclidean structure matrix :math:`(\mathbf{D}(\mathbf{X}) \in R^{n \times n}`,
967968
feature matrix :math:`(\mathbf{F} \in R^{n \times d}` and node relative importance
968969
:math:`(\mathbf{p} \in \Sigma_n`, into a partitioned attributed graph
969-
taking into account partitions and representants :math:`\mathcal{P} = \left{(\mathbf{P_{i}}, \mathbf{r_{i}})\right}_i`.
970+
taking into account partitions and representants
971+
:math:`\mathcal{P} = \left\{(\mathbf{P_{i}}, \mathbf{r_{i}})\right\}_i`.
970972
971973
Parameters
972974
----------

ot/gromov/_semirelaxed.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ def semirelaxed_gromov_wasserstein(
6464
- :math:`\mathbf{C_1}`: Metric cost matrix in the source space
6565
- :math:`\mathbf{C_2}`: Metric cost matrix in the target space
6666
- :math:`\mathbf{p}`: distribution in the source space
67-
6867
- `L`: loss function to account for the misfit between the similarity matrices
6968
7069
.. note:: This function is backend-compatible and will work on arrays
@@ -883,7 +882,6 @@ def entropic_semirelaxed_gromov_wasserstein(
883882
- :math:`\mathbf{C_1}`: Metric cost matrix in the source space
884883
- :math:`\mathbf{C_2}`: Metric cost matrix in the target space
885884
- :math:`\mathbf{p}`: distribution in the source space
886-
887885
- `L`: loss function to account for the misfit between the similarity matrices
888886
889887
.. note:: This function is backend-compatible and will work on arrays
@@ -1070,6 +1068,7 @@ def entropic_semirelaxed_gromov_wasserstein2(
10701068
10711069
Note that when using backends, this loss function is differentiable wrt the
10721070
matrices (C1, C2) but not yet for the weights p.
1071+
10731072
.. note:: This function is backend-compatible and will work on arrays
10741073
from all compatible backends. However all the steps in the conditional
10751074
gradient are not differentiable.

ot/gromov/_unbalanced.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ def fused_unbalanced_across_spaces_divergence(
5050
with the distributions on rows and columns. We consider two cases of matrix:
5151
5252
- (Squared) similarity matrix in Gromov-Wasserstein setting,
53-
whose rows and columns represent the samples.
53+
whose rows and columns represent the samples.
5454
5555
- Arbitrary-size matrix in Co-Optimal Transport setting,
56-
whose rows represent samples, and columns represent corresponding features/dimensions.
56+
whose rows represent samples, and columns represent corresponding features/dimensions.
5757
5858
More precisely, this function returns the sample and feature transport plans between
5959
:math:`(\mathbf{X}, \mathbf{w}_{xs}, \mathbf{w}_{xf})` and

ot/lp/_barycenter_solvers.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -427,16 +427,20 @@ def generalized_free_support_barycenter(
427427
def ot_barycenter_energy(measure_locations, measure_weights, X, a, cost_list, nx=None):
428428
r"""
429429
Computes the energy of the OT barycenter functional for a given barycenter
430-
support `X` and weights `a`: .. math::
430+
support `X` and weights `a`:
431+
432+
.. math::
431433
V(X, a) = \sum_{k=1}^K w_k \mathcal{T}_{c_k}(X, a, Y_k, b_k),
432434
433-
where: - :math:`X` (n, d) is the barycenter support, - :math:`a` (n) is the
434-
barycenter weights, - :math:`Y_k` (m_k, d_k) is the k-th measure support
435-
(`measure_locations[k]`),
435+
where:
436+
437+
- :math:`X` (n, d) is the barycenter support,
438+
- :math:`a` (n) is the barycenter weights,
439+
- :math:`Y_k` (m_k, d_k) is the k-th measure support (`measure_locations[k]`),
436440
- :math:`b_k` (m_k) is the k-th measure weights (`measure_weights[k]`),
437441
- :math:`c_k: \mathbb{R}^{n\times d}\times\mathbb{R}^{m_k\times d_k}
438-
\rightarrow \mathbb{R}_+^{n\times m_k}` is the k-th cost function
439-
(which computes the pairwise cost matrix)
442+
\rightarrow \mathbb{R}_+^{n\times m_k}` is the k-th cost function
443+
(which computes the pairwise cost matrix)
440444
- :math:`\mathcal{T}_{c_k}(X, a, Y_k, b)` is the OT cost between the
441445
barycenter measure and the k-th measure with respect to the cost
442446
:math:`c_k`.

ot/optim.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ def generic_conditional_gradient(
164164
conditional gradient or generalized conditional gradient depending on the
165165
provided linear program solver.
166166
167-
The function solves the following optimization problem if set as a conditional gradient:
167+
The function solves the following optimization problem if set as a conditional gradient:
168168
169169
.. math::
170170
\gamma = \mathop{\arg \min}_\gamma \quad \langle \gamma, \mathbf{M} \rangle_F +
171171
\mathrm{reg_1} \cdot f(\gamma)
172172
173173
s.t. \ \gamma \mathbf{1} &= \mathbf{a}
174174
175-
\gamma^T \mathbf{1} &= \mathbf{b} (optional constraint)
175+
\gamma^T \mathbf{1} &= \mathbf{b} \ (\text{optional constraint})
176176
177177
\gamma &\geq 0
178178
@@ -184,7 +184,7 @@ def generic_conditional_gradient(
184184
185185
The algorithm used for solving the problem is conditional gradient as discussed in :ref:`[1] <references-cg>`
186186
187-
The function solves the following optimization problem if set a generalized conditional gradient:
187+
The function solves the following optimization problem if set a generalized conditional gradient:
188188
189189
.. math::
190190
\gamma = \mathop{\arg \min}_\gamma \quad \langle \gamma, \mathbf{M} \rangle_F +

0 commit comments

Comments
 (0)