Skip to content

Commit e081dea

Browse files
committed
FIX bincount removed from sklearn.utils
1 parent b246d06 commit e081dea

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

imblearn/metrics/classification.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
from sklearn.metrics.classification import (_check_targets, _prf_divide,
2727
precision_recall_fscore_support)
2828
from sklearn.preprocessing import LabelEncoder
29-
from sklearn.utils.fixes import bincount
3029
from sklearn.utils.multiclass import unique_labels
3130

3231
try:
@@ -203,16 +202,16 @@ def sensitivity_specificity_support(y_true,
203202
tp_bins_weights = None
204203

205204
if len(tp_bins):
206-
tp_sum = bincount(
205+
tp_sum = np.bincount(
207206
tp_bins, weights=tp_bins_weights, minlength=len(labels))
208207
else:
209208
# Pathological case
210209
true_sum = pred_sum = tp_sum = np.zeros(len(labels))
211210
if len(y_pred):
212-
pred_sum = bincount(
211+
pred_sum = np.bincount(
213212
y_pred, weights=sample_weight, minlength=len(labels))
214213
if len(y_true):
215-
true_sum = bincount(
214+
true_sum = np.bincount(
216215
y_true, weights=sample_weight, minlength=len(labels))
217216

218217
# Compute the true negative
@@ -611,14 +610,14 @@ class is unrecognized by the classifier, G-mean resolves to zero. To
611610
tp_bins_weights = None
612611

613612
if len(tp_bins):
614-
tp_sum = bincount(tp_bins, weights=tp_bins_weights,
615-
minlength=len(labels))
613+
tp_sum = np.bincount(tp_bins, weights=tp_bins_weights,
614+
minlength=len(labels))
616615
else:
617616
# Pathological case
618617
true_sum = tp_sum = np.zeros(len(labels))
619618
if len(y_true):
620-
true_sum = bincount(y_true, weights=sample_weight,
621-
minlength=len(labels))
619+
true_sum = np.bincount(y_true, weights=sample_weight,
620+
minlength=len(labels))
622621

623622
# Retain only selected labels
624623
indices = np.searchsorted(sorted_labels, labels[:n_labels])

0 commit comments

Comments
 (0)