weighted_percentile
should error/warn when all sample weights 0
#31032
Labels
weighted_percentile
should error/warn when all sample weights 0
#31032
Describe the bug
Noticed while working on #29431
Steps/Code to Reproduce
See the following test:
scikit-learn/sklearn/utils/tests/test_stats.py
Lines 67 to 73 in cd0478f
Expected Results
Error or warning should probably be given. You're effectively asking for a quantile of a empty array.
Actual Results
When all sample weights are 0, what happens is that
percentile_in_sorted
(as in the index of desired observation in array is the) is101
(the last item). We should probably add a check and give a warning whensample_weights
is all zerocc @ogrisel @glemaitre
Versions
The text was updated successfully, but these errors were encountered: