Is there a way to choose k nearest neighbors in scikits to learn with a user-defined distance metric?

I have to use K nearest neighbors for a set of vectors using the cosine similarity metric and some other user-defined metrics. How can I achieve this using scikits? I found sklearn.neighbors.KNeighborsClassifier, but I was not able to determine any version of the user-defined metrics. I am currently using the latest version of scikits learn 0.11.

+3
source share
1 answer

It is impossible (so far?) To transfer the previously calculated or lazily calculated by the user distance functions in the kNN model.

p p-Minkowsky:

https://github.com/scikit-learn/scikit-learn/pull/742

, ( ) .

: http://metaoptimize.com/qa/questions/9691/efficient-nearest-neighbors-in-a-very-sparse-settings

+3

All Articles