epsilon-machine / missingpy

Missing Data Imputation for Python
GNU General Public License v3.0
236 stars 63 forks source link

Update scikit-learn version. #38

Open FilipeSacchetto opened 1 year ago

FilipeSacchetto commented 1 year ago

The current scikit-learn version does not support the module 'sklearn.neighbors.base'. I think the new module is named _base.

Jose-Verdu-Diaz commented 1 year ago

This was also mentioned in #27.

You might be able to make it work by renaming the module:

import sklearn.neighbors._base
sys.modules['sklearn.neighbors.base'] = sklearn.neighbors._base

In my case, I get another error when missingpy tries to load '_check_weights' from 'sklearn.neighbors._base', as it was removed from sklearn 1.2.0. missingpy should be updated to 1.2.0 and avoid using sklearn private methods.

You can always downgrade your sklearn version, if that does not destroy your working environment.

NilToOne commented 1 year ago

Since the author hasn't updated yet, you have to edit the local library file to avoid the error.

1.Go to the \Lib\site-packages\missingpy\knnimpute.py .

2.Delete the from sklearn.neighbors.base import _check_weights .

3.Copy the "_check_weights" function codes from here. And paste to the knnimpute.py.