I am trying to perform a balancing between two classes, one majority and one minority. The majority class is a number of no landslide points and the minority class is landslide. I am trying to apply the Easy Ensemble method to balance the data: I want to have the same number of landslide and no landslide data points.
This is the function:
from imblearn.ensemble import EasyEnsembleClassifier
def eec(X, y,random_state=None, n_estimators=10):
random_state = random_state if random_state is not None else 42
n_estimators=10
eec = EasyEnsembleClassifier(random_state = random_state, n_estimators=10)
X_res, y_res = eec.fit_resample(X, y)
ax = y_res.value_counts().plot.pie(autopct='%.1f')
_ = ax.set_title("EEC Frana result")
return X_res, y_res
The error I get is this:
AttributeError: 'EasyEnsembleClassifier' object has no attribute 'fit_resample'
I tried to update imbalanced-learn or use fit_sample but I have the same problem. How can I solve it?