Search code examples
pythonscikit-learnjupyterimblearnsmote

AttributeError: module 'sklearn.metrics._dist_metrics' has no attribute 'DatasetsPair'


I'm trying to balanced my data on jupyter-notebook, using SMOTE:

from imblearn import over_sampling
from imblearn.over_sampling import SMOTE
balanced = SMOTE()
x_balanced , y_balanced = balanced.fit_resample(X_train,y_train)

but I'm getting the following error on the first line -

AttributeError: module 'sklearn.metrics._dist_metrics' has no attribute 'DatasetsPair'

Why am I getting this error? thanks.


Solution

  • Reinstall scikit learn to version 1.1.0. That should solve the problem