diff --git a/RELEASES.md b/RELEASES.md index 848cd69fe..542f94851 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -30,6 +30,7 @@ - Clean references in documentation (PR #722) - Clean documentation for `ot.gromov.gromov_wasserstein` (PR #737) - Debug wheels building (PR #739) +- Fix doc for projection sparse simplex (PR #734, PR #746) ## 0.9.5 diff --git a/ot/utils.py b/ot/utils.py index 551ccf7f4..0f5ec1f9f 100644 --- a/ot/utils.py +++ b/ot/utils.py @@ -140,11 +140,15 @@ def projection_sparse_simplex(V, max_nz, z=1, axis=None, nx=None): r"""Projection of :math:`\mathbf{V}` onto the simplex with cardinality constraint (maximum number of non-zero elements) and then scaled by `z`. .. math:: - P\left(\mathbf{V}, max_nz, z\right) = \mathop{\arg \min}_{\substack{\mathbf{y} >= 0 \\ \sum_i \mathbf{y}_i = z} \\ ||p||_0 \le \text{max_nz}} \quad \|\mathbf{y} - \mathbf{V}\|^2 + P\left(\mathbf{V}, \text{max_nz}, z\right) = \mathop{\arg \min}_{\substack{\mathbf{y} >= 0 \\ \sum_i \mathbf{y}_i = z} \\ ||p||_0 \le \text{max_nz}} \quad \|\mathbf{y} - \mathbf{V}\|^2 Parameters ---------- V: 1-dim or 2-dim ndarray + max_nz: int + Maximum number of non-zero elements in the projection. + If `max_nz` is larger than the number of elements in `V`, then + the projection is equivalent to `proj_simplex(V, z)`. z: float or array If array, len(z) must be compatible with :math:`\mathbf{V}` axis: None or int @@ -156,8 +160,9 @@ def projection_sparse_simplex(V, max_nz, z=1, axis=None, nx=None): ------- projection: ndarray, shape :math:`\mathbf{V}`.shape - References: - Sparse projections onto the simplex + References + ---------- + .. [1] Sparse projections onto the simplex Anastasios Kyrillidis, Stephen Becker, Volkan Cevher and, Christoph Koch ICML 2013 https://arxiv.org/abs/1206.1529