@@ -605,7 +605,7 @@ def _randomized_eigsh(
605
605
606
606
607
607
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 .
609
609
610
610
If there is more than one such value, only the first is returned.
611
611
The bin-count for the modal bins is also returned.
@@ -614,10 +614,10 @@ def weighted_mode(a, w, *, axis=0):
614
614
615
615
Parameters
616
616
----------
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.
621
621
axis : int, default=0
622
622
Axis along which to operate. Default is 0, i.e. the first axis.
623
623
@@ -628,6 +628,11 @@ def weighted_mode(a, w, *, axis=0):
628
628
score : ndarray
629
629
Array of weighted counts for each mode.
630
630
631
+ See Also
632
+ --------
633
+ scipy.stats.mode: Calculates the Modal (most common) value of array elements
634
+ along specified axis.
635
+
631
636
Examples
632
637
--------
633
638
>>> from sklearn.utils.extmath import weighted_mode
@@ -645,10 +650,6 @@ def weighted_mode(a, w, *, axis=0):
645
650
646
651
The value 2 has the highest score: it appears twice with weights of
647
652
1.5 and 2: the sum of these is 3.5.
648
-
649
- See Also
650
- --------
651
- scipy.stats.mode
652
653
"""
653
654
if axis is None :
654
655
a = np .ravel (a )
0 commit comments