Skip to content

Implementing partial_fit for NearestCentroid #12952

@dirkpadfield

Description

@dirkpadfield

Description

The NearestCentroid classifier (https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.NearestCentroid.html) does not currently have a partial_fit method, but it would be very useful when running the algorithm in an online fashion. The math for implementing it is simple; it's just a matter of updating the centroids weighted by the number of samples. The implementation could be similar to the partial_fit method of the GaussianNB classifier (except for the obvious mathematical differences). I'm happy to submit an implementation of this, but I wanted to gather input first to see if others have already done this and whether others would find this useful.

Steps/Code to Reproduce

Look at NearestCentroid classifier code and notice that it has not partial_fit method.

Expected Results

There should be a partial_fit method.

Actual Results

There is no partial_fit method.

Versions

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions