Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4575637

Browse files
authored
DOC ensure sklearn/utils/extmath/stable_cumsum passes numpydoc (#24348)
1 parent 939ce4d commit 4575637

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

sklearn/tests/test_docstrings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"sklearn.utils.extmath.randomized_svd",
3535
"sklearn.utils.extmath.safe_sparse_dot",
3636
"sklearn.utils.extmath.squared_norm",
37-
"sklearn.utils.extmath.stable_cumsum",
3837
"sklearn.utils.extmath.svd_flip",
3938
"sklearn.utils.extmath.weighted_mode",
4039
"sklearn.utils.fixes.delayed",

sklearn/utils/extmath.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,9 @@ def _deterministic_vector_sign_flip(u):
10571057
def stable_cumsum(arr, axis=None, rtol=1e-05, atol=1e-08):
10581058
"""Use high precision for cumsum and check that final value matches sum.
10591059
1060+
Warns if the final cumulative sum does not match the sum (up to the chosen
1061+
tolerance).
1062+
10601063
Parameters
10611064
----------
10621065
arr : array-like
@@ -1068,6 +1071,11 @@ def stable_cumsum(arr, axis=None, rtol=1e-05, atol=1e-08):
10681071
Relative tolerance, see ``np.allclose``.
10691072
atol : float, default=1e-08
10701073
Absolute tolerance, see ``np.allclose``.
1074+
1075+
Returns
1076+
-------
1077+
out : ndarray
1078+
Array with the cumulative sums along the chosen axis.
10711079
"""
10721080
out = np.cumsum(arr, axis=axis, dtype=np.float64)
10731081
expected = np.sum(arr, axis=axis, dtype=np.float64)

0 commit comments

Comments
 (0)