Why doesnt SKLearn's Distance Metric class have Cosine Distance?
<p>I am trying to get KNN with cosine distance but it looks like the metric parameter does not take cosine distance. Only the below metrics are available in <a href="http://scikit-learn.org/stable/modules/generated/sklearn.neighbors.DistanceMetric.html" rel="nofollow">http://scikit-learn.org/stable/modules/generated/sklearn.neighbors.DistanceMetric.html</a> . Why is that ? </p>

<p>Metrics intended for real-valued vector spaces:
identifier  class name  args    distance function
“euclidean” EuclideanDistance<br>
sqrt(sum((x - y)^2))
“manhattan” ManhattanDistance<br>
sum(|x - y|)
“chebyshev” ChebyshevDistance<br>
sum(max(|x - y|))
“minkowski” MinkowskiDistance   p   sum(|x - y|^p)^(1/p)
“wminkowski”    WMinkowskiDistance  p, w    sum(w * |x - y|^p)^(1/p)
“seuclidean”    SEuclideanDistance  V   sqrt(sum((x - y)^2 / V))
“mahalanobis”   MahalanobisDistance V or VI sqrt((x - y)' V^-1 (x - y))
Metrics intended for two-dimensional vector spaces:
identifier  class name  distance function
“haversine” HaversineDistance<br>
2 arcsin(sqrt(sin^2(0.5*dx)
cos(x1)cos(x2)sin^2(0.5*dy)))</p>