Reputation: 4690
For scikit-learn's KNN package, can one specify a pairwise distance metric (from the package sklearn.metrics.pairwise
) that isn't the p-norm, or Minkowski distance? For example, could I use the RBF kernel? Or even the cosine distance?
Upvotes: 1
Views: 2119
Reputation: 40159
Unfortunately the BallTree algorithm that is used to compute fast exact NN search on low to medium number of dimensions cannot work with arbitrary metrics.
Upvotes: 2