_check_weights() was removed from sklearn after version 1.2.X. Therefore, missingpy is no longer compatible with the latest version of SciKit-learn.
As a quick fix I copied the original code from the sklearn/neighbors/_base.py file (version 0.22.X) to my local copy of missingpy/knnimpute.py:
def _check_weights(weights):
"""Check to make sure weights are valid"""
if weights in (None, 'uniform', 'distance'):
return weights
elif callable(weights):
return weights
else:
raise ValueError("weights not recognized: should be 'uniform', "
"'distance', or a callable function")
... and removed the import:
# from sklearn.neighbors.base import _check_weight
_check_weights() was removed from sklearn after version 1.2.X. Therefore, missingpy is no longer compatible with the latest version of SciKit-learn.
As a quick fix I copied the original code from the
sklearn/neighbors/_base.py
file (version 0.22.X) to my local copy ofmissingpy/knnimpute.py
:... and removed the import: