I am trying to use RandomOverSampler from imblearn but I'm getting error.
Looking at other posts, there seems to be a problem with older versions, but I checked my versions and I have:
sklearn.__version__
'0.24.1'
imblearn.__version__
'0.8.0'
This is the code I'm trying to run:
from imblearn.over_sampling import RandomOverSampler
OS = RandomOverSampler(sampling_strategy='auto', random_state=0)
osx, osy = OS.fit_sample(X, y)
And the error I get is:
---------------------------------------------------------------------------
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'
You want OS.fit_resample(X, y)
, not fit_sample
.