【发布时间】:2021-06-15 10:53:24
【问题描述】:
我正在尝试使用 imblearn 中的 RandomOverSampler,但出现错误。
看其他帖子,老版本好像有问题,但是我检查了我的版本,我有:
sklearn.__version__
'0.24.1'
imblearn.__version__
'0.8.0'
这是我要运行的代码:
from imblearn.over_sampling import RandomOverSampler
OS = RandomOverSampler(sampling_strategy='auto', random_state=0)
osx, osy = OS.fit_sample(X, y)
我得到的错误是:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-9-a080b92fc7bc> in <module>
2
3 OS = RandomOverSampler(sampling_strategy='auto', random_state=0)
----> 4 osx, osy = OS.fit_sample(X, y)
AttributeError: 'RandomOverSampler' object has no attribute 'fit_sample'
【问题讨论】:
标签: python scikit-learn imblearn