Skip to content

_check_weights() no longer exists in SciKit-learn #41

Description

@franzhuettinger

_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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions