rapidsai / cuml

cuML - RAPIDS Machine Learning Library
https://docs.rapids.ai/api/cuml/stable/
Apache License 2.0
4.24k stars 532 forks source link

[FEA] Support for Weights in Nearest Neighbors #3006

Open nils-fl opened 4 years ago

nils-fl commented 4 years ago

It would be great to have a sample_weight option in the cuml.LogisticRegression fit() method like in sklearn. That way one could easily implement custom penalty methods.

viclafargue commented 4 years ago

Thank you for opening the issue. Tagging @dantegd and @JohnZed

asedova commented 3 years ago

We also would really like weights in KNN classifier, like in scikit learn:

weights{‘uniform’, ‘distance’} or callable, default=’uniform’
weight function used in prediction. Possible values:

‘uniform’ : uniform weights. All points in each neighborhood are weighted equally.

‘distance’ : weight points by the inverse of their distance. in this case, closer neighbors of a query point will have a greater influence than neighbors which are further away.

[callable] : a user-defined function which accepts an array of distances, and returns an array of the same shape containing the weights.

This is really helpful for a lot of data where the location of vector elements matters, etc.

github-actions[bot] commented 3 years ago

This issue has been marked stale due to no recent activity in the past 30d. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be marked rotten if there is no activity in the next 60d.

beckernick commented 3 years ago

This was implemented in https://github.com/rapidsai/cuml/pull/3572 . Given https://github.com/rapidsai/cuml/issues/3559 also covered sample weights for logistic regression, rather than close this issue I will update it to request KNN weights as per the most recent comment