From 5faa4fbdb1a64351a42d31dd6f54f0402c29c405 Mon Sep 17 00:00:00 2001 From: Oleksii Kachaiev Date: Thu, 11 May 2023 08:23:06 +0200 Subject: [PATCH] [DOC] Fix references to JAX and numpy functions (#475) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix ref to JAX * Fix references to numpy.random.* * Typo in CONTRIBUTING * Removed :any: reference from func parameters * Make markup of params consistent with other docstrings * Mentioned latest open PR in RELEASES * Fix See Also references for ot.factored --------- Co-authored-by: RĂ©mi Flamary --- .github/CONTRIBUTING.md | 2 +- RELEASES.md | 2 +- docs/source/conf.py | 5 +++-- ot/backend.py | 6 +++--- ot/factored.py | 4 ++-- ot/solvers.py | 10 +++++----- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 168ffb34c..c66ab3e61 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -199,4 +199,4 @@ method does to the data and a figure (coming from an example) illustrating it. -This Contribution guide is strongly inpired by the one of the [scikit-learn](https://github.com/scikit-learn/scikit-learn) team. +This Contribution guide is strongly inspired by the one of the [scikit-learn](https://github.com/scikit-learn/scikit-learn) team. diff --git a/RELEASES.md b/RELEASES.md index 0870b34d3..5c50423ce 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -12,7 +12,7 @@ - Fix circleci-redirector action and codecov (PR #460) - Fix issues with cuda for ot.binary_search_circle and with gradients for ot.sliced_wasserstein_sphere (PR #457) -- Major documentation cleanup (PR #462, #467) +- Major documentation cleanup (PR #462, #467, #475) - Fix gradients for "Wasserstein2 Minibatch GAN" example (PR #466) - Faster Bures-Wasserstein distance with NumPy backend (PR #468) - Fix issue backend for ot.sliced_wasserstein_sphere ot.sliced_wasserstein_sphere_unif (PR #471) diff --git a/docs/source/conf.py b/docs/source/conf.py index b7a9e3598..e88804bd6 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -348,10 +348,11 @@ def __getattr__(cls, name): # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {'python': ('https://docs.python.org/3', None), - 'numpy': ('http://docs.scipy.org/doc/numpy/', None), + 'numpy': ('https://numpy.org/doc/stable/', None), 'scipy': ('http://docs.scipy.org/doc/scipy/reference/', None), 'matplotlib': ('http://matplotlib.org/', None), - 'torch': ('https://pytorch.org/docs/stable/', None)} + 'torch': ('https://pytorch.org/docs/stable/', None), + 'jax': ('https://jax.readthedocs.io/en/latest/', None)} sphinx_gallery_conf = { 'examples_dirs': ['../../examples', '../../examples/da'], diff --git a/ot/backend.py b/ot/backend.py index 9aa14e6b2..33c323d92 100644 --- a/ot/backend.py +++ b/ot/backend.py @@ -680,7 +680,7 @@ def seed(self, seed=None): This function follows the api from :any:`numpy.random.seed` - See: https://numpy.org/doc/stable/reference/generated/numpy.random.seed.html + See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html """ raise NotImplementedError() @@ -690,7 +690,7 @@ def rand(self, *size, type_as=None): This function follows the api from :any:`numpy.random.rand` - See: https://numpy.org/doc/stable/reference/generated/numpy.random.rand.html + See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html """ raise NotImplementedError() @@ -700,7 +700,7 @@ def randn(self, *size, type_as=None): This function follows the api from :any:`numpy.random.rand` - See: https://numpy.org/doc/stable/reference/generated/numpy.random.rand.html + See: https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html """ raise NotImplementedError() diff --git a/ot/factored.py b/ot/factored.py index abc244545..8d6615876 100644 --- a/ot/factored.py +++ b/ot/factored.py @@ -81,8 +81,8 @@ def factored_optimal_transport(Xa, Xb, a=None, b=None, reg=0.0, r=100, X0=None, See Also -------- - ot.bregman.sinkhorn : Entropic regularized OT ot.optim.cg : General - regularized OT + ot.bregman.sinkhorn : Entropic regularized OT + ot.optim.cg : General regularized OT """ nx = get_backend(Xa, Xb) diff --git a/ot/solvers.py b/ot/solvers.py index 0294d714c..bba2734e5 100644 --- a/ot/solvers.py +++ b/ot/solvers.py @@ -28,10 +28,10 @@ def solve(M, a=None, b=None, reg=None, reg_type="KL", unbalanced=None, \lambda_u U(\mathbf{T}\mathbf{1},\mathbf{a}) + \lambda_u U(\mathbf{T}^T\mathbf{1},\mathbf{b}) - The regularization is selected with :any:`reg` (:math:`\lambda_r`) and :any:`reg_type`. By + The regularization is selected with `reg` (:math:`\lambda_r`) and `reg_type`. By default ``reg=None`` and there is no regularization. The unbalanced marginal - penalization can be selected with :any:`unbalanced` (:math:`\lambda_u`) and - :any:`unbalanced_type`. By default ``unbalanced=None`` and the function + penalization can be selected with `unbalanced` (:math:`\lambda_u`) and + `unbalanced_type`. By default ``unbalanced=None`` and the function solves the exact optimal transport problem (respecting the marginals). Parameters @@ -46,12 +46,12 @@ def solve(M, a=None, b=None, reg=None, reg_type="KL", unbalanced=None, Regularization weight :math:`\lambda_r`, by default None (no reg., exact OT) reg_type : str, optional - Type of regularization :math:`R` either "KL", "L2", 'entropy', by default "KL" + Type of regularization :math:`R` either "KL", "L2", "entropy", by default "KL" unbalanced : float, optional Unbalanced penalization weight :math:`\lambda_u`, by default None (balanced OT) unbalanced_type : str, optional - Type of unbalanced penalization unction :math:`U` either "KL", "L2", 'TV', by default 'KL' + Type of unbalanced penalization unction :math:`U` either "KL", "L2", "TV", by default "KL" n_threads : int, optional Number of OMP threads for exact OT solver, by default 1 max_iter : int, optional