8000 DOC Ensures that sklearn.utils.extmath.weighted_mode passes numpydoc … · scikit-learn/scikit-learn@c674e58 · GitHub
[go: up one dir, main page]

Skip to content

Commit c674e58

Browse files
awinmljeremiedbb
andauthored
DOC Ensures that sklearn.utils.extmath.weighted_mode passes numpydoc validation (#24571)
Co-authored-by: jeremie du boisberranger <jeremiedbb@yahoo.fr>
1 parent 06c36bb commit c674e58

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

sklearn/tests/test_docstrings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"sklearn.utils.extmath.fast_logdet",
1616
"sklearn.utils.extmath.randomized_svd",
1717
"sklearn.utils.extmath.svd_flip",
18-
"sklearn.utils.extmath.weighted_mode",
1918
"sklearn.utils.fixes.delayed",
2019
# To be fixed in upstream issue:
2120
# https://github.com/joblib/threadpoolctl/issues/108

sklearn/utils/extmath.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ def _randomized_eigsh(
605605

606606

607607
def weighted_mode(a, w, *, axis=0):
608-
"""Returns an array of the weighted modal (most common) value in a.
608+
"""Return an array of the weighted modal (most common) value in the passed array.
609609
610610
If there is more than one such value, only the first is returned.
611611
The bin-count for the modal bins is also returned.
@@ -614,10 +614,10 @@ def weighted_mode(a, w, *, axis=0):
614614
615615
Parameters
616616
----------
617-
a : array-like
618-
n-dimensional array of which to find mode(s).
619-
w : array-like
620-
n-dimensional array of weights for each value.
617+
a : array-like of shape (n_samples,)
618+
Array of which values to find mode(s).
619+
w : array-like of shape (n_samples,)
620+
Array of weights for each value.
621621
axis : int, default=0
622622
Axis along which to operate. Default is 0, i.e. the first axis.
623623
@@ -628,6 +628,11 @@ def weighted_mode(a, w, *, axis=0):
628628
score : ndarray
629629
Array of weighted counts for each mode.
630630
631+
See Also
632+
--------
633+
scipy.stats.mode: Calculates the Modal (most common) value of array elements
634+
along specified axis.
635+
631636
Examples
632637
--------
633638
>>> from sklearn.utils.extmath import weighted_mode
@@ -645,10 +650,6 @@ def weighted_mode(a, w, *, axis=0):
645650
646651
The value 2 has the highest score: it appears twice with weights of
647652
1.5 and 2: the sum of these is 3.5.
648-
649-
See Also
650-
--------
651-
scipy.stats.mode
652653
"""
653654
if axis is None:
654655
a = np.ravel(a)

0 commit comments

Comments
 (0)
0