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

Question:

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.

Asked By: omerk

||

Answers:

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

Answered By: drag88

Had the same error while importing modules from skforecast package

from skforecast.model_selection import grid_search_forecaster
from skforecast.model_selection import backtesting_forecaster

Reinstalling scikit-learn to version 1.1.0 or 1.0.0 worked with additionally restarting the jupyter server.

Answered By: biban