Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#### Documentation

- Clarify how transported mass is interpreted in partial optimal transport and extend the existing 2D example with a deterministic mass sweep and matched-mass summaries (Issue #890).
- Fix the `ot.batch` docstrings that broke the API page: malformed `References` and `Examples` sections, the dictionaries listed under `Returns`, and a citation in `solve_sample_batch` pointing to [91] instead of [92] (Issue #222)

#### Closed issues

Expand Down
24 changes: 12 additions & 12 deletions ot/batch/_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ def solve_batch(

See :any:`OTResult` for more information.

See Also
--------
ot.batch.dist_batch : batched cost matrix computation for computing M.
ot.solve : non-batched version of the solve_batch function.

Examples
--------
>>> import numpy as np
Expand All @@ -328,21 +333,16 @@ def solve_batch(
>>> s_result.value.shape # Optimal transport values for each batch
(5,)

See Also
--------
ot.batch.dist_batch : batched cost matrix computation for computing M.
ot.solve : non-batched version of the solve_batch function.

.. _references-batch-solver:
Reference
References
----------
.. [92] Xie, Y., Wang, X., Wang, R., & Zha, H. (2020, August).
A fast proximal point method for computing exact wasserstein distance.
In Uncertainty in artificial intelligence (pp. 433-453). PMLR.
.. [92] Xie, Y., Wang, X., Wang, R., & Zha, H. (2020, August).
A fast proximal point method for computing exact wasserstein distance.
In Uncertainty in artificial intelligence (pp. 433-453). PMLR.

.. [2] M. Cuturi, Sinkhorn Distances : Lightspeed Computation
of Optimal Transport, Advances in Neural Information Processing
Systems (NIPS) 26, 2013
of Optimal Transport, Advances in Neural Information Processing
Systems (NIPS) 26, 2013
"""

if method not in solve_batch_method_lst:
Expand Down Expand Up @@ -453,7 +453,7 @@ def solve_sample_batch(
r"""
Return solutions of a batch of discrete optimal transport problems in a :any:`OTResult` object computed from batches of source and target samples.

The problem is solved with either a proximal point method :ref:`[91] <references-batch-solver>` or a Sinkhorn algorithm :ref:`[2] <references-batch-solver>`. Unlike the Sinkhorn algorithm, which assumes a regularization term, the proximal point method can solve both regularized and unregularized optimal transport problems. When `method` is set to 'auto', the function automatically selects the appropriate method based on the value of `reg`. if `reg` is None or 0, the proximal point method is used. If `reg` is greater than 0, the Sinkhorn algorithm is used.
The problem is solved with either a proximal point method :ref:`[92] <references-batch-solver>` or a Sinkhorn algorithm :ref:`[2] <references-batch-solver>`. Unlike the Sinkhorn algorithm, which assumes a regularization term, the proximal point method can solve both regularized and unregularized optimal transport problems. When `method` is set to 'auto', the function automatically selects the appropriate method based on the value of `reg`. if `reg` is None or 0, the proximal point method is used. If `reg` is greater than 0, the Sinkhorn algorithm is used.

Parameters
----------
Expand Down
1 change: 1 addition & 0 deletions ot/batch/_quadratic.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def tensor_batch(
-------
dict
Dictionary containing:

- constC : array-like, shape (B, n, m)
Constant term in the tensor product.
- hCa : array-like, shape (B, n, n, d) or (B, n, n)
Expand Down
13 changes: 8 additions & 5 deletions ot/batch/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def bregman_projection_batch(
-------
dict
Dictionary containing:

- 'T' : array-like, shape (B, n, m)
Optimal transport plan for each problem.
- 'potentials' : tuple of array-like, shapes ((B, n), (B, m))
Expand Down Expand Up @@ -231,6 +232,7 @@ def bregman_log_projection_batch(
-------
dict
Dictionary containing:

- 'T' : array-like, shape (B, n, m)
Optimal transport plan for each problem.
- 'log_T' : array-like, shape (B, n, m)
Expand Down Expand Up @@ -363,6 +365,7 @@ def proximal_bregman_log_plan_batch(
-------
dict
Dictionary containing:

- 'T' : array-like, shape (B, n, m)
Optimal transport plan for each problem.
- 'log_T' : array-like, shape (B, n, m)
Expand All @@ -372,7 +375,7 @@ def proximal_bregman_log_plan_batch(
- 'n_iters' : int
Number of iterations performed.

Example
Examples
--------
>>> import numpy as np
>>> from ot.batch import proximal_bregman_log_plan_batch
Expand All @@ -382,11 +385,11 @@ def proximal_bregman_log_plan_batch(
>>> T = result['T'] # Shape (5, 10, 15)

.. _references-OT-bregman-proximal-point:
Reference
References
----------
.. [92] Xie, Y., Wang, X., Wang, R., & Zha, H. (2020, August).
A fast proximal point method for computing exact wasserstein distance.
In Uncertainty in artificial intelligence (pp. 433-453). PMLR.
.. [92] Xie, Y., Wang, X., Wang, R., & Zha, H. (2020, August).
A fast proximal point method for computing exact wasserstein distance.
In Uncertainty in artificial intelligence (pp. 433-453). PMLR.
"""

if nx is None:
Expand Down
Loading