RandomUnderSampler'对象没有“fit\u resample”属性

2024-03-28 22:51:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用来自imblearnRandomUnderSampler,但是我得到以下错误。有什么想法吗?谢谢

from imblearn.under_sampling import RandomUnderSampler
print('Initial dataset shape %s' % Counter(y.values.squeeze()))
rus = RandomUnderSampler(random_state=42)
X_undersampled, y_undersampled = rus.fit_resample(X, y)
y_undersampled = y_undersampled.squeeze()

输出:

^{pr2}$

我使用的主要库:

imbalanced-learn==0.3.3
pandas==0.24.2
numpy==1.15.4
scikit-learn==0.19.2

Tags: fromimport错误learndatasetinitialprintshape