diff --git a/RELEASES.md b/RELEASES.md index b0e12bb7c..6a6450c0f 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -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 diff --git a/ot/batch/_linear.py b/ot/batch/_linear.py index 59c3e5c5a..bf19cff39 100644 --- a/ot/batch/_linear.py +++ b/ot/batch/_linear.py @@ -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 @@ -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: @@ -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] ` or a Sinkhorn algorithm :ref:`[2] `. 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] ` or a Sinkhorn algorithm :ref:`[2] `. 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 ---------- diff --git a/ot/batch/_quadratic.py b/ot/batch/_quadratic.py index 052c46437..228b2d2fb 100644 --- a/ot/batch/_quadratic.py +++ b/ot/batch/_quadratic.py @@ -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) diff --git a/ot/batch/_utils.py b/ot/batch/_utils.py index 1521e663f..3be366cc3 100644 --- a/ot/batch/_utils.py +++ b/ot/batch/_utils.py @@ -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)) @@ -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) @@ -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) @@ -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 @@ -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: