Perhaps this is elementary, but I cannot find a good example of using mahalanobis
distance in sklearn
.
I can't even get the metric like this:
from sklearn.neighbors import DistanceMetric
DistanceMetric.get_metric('mahalanobis')
This throws an error: TypeError: 0-dimensional array given. Array must be at least two-dimensional
.
But, I can't even seem to get it to take an array:
DistanceMetric.get_metric('mahalanobis', [[0.5],[0.7]])
throws:
TypeError: get_metric() takes exactly 1 positional argument (2 given)
I checked out the docs here and here. But, I don't see what types of arguments it is expecting.
Is there an example of using the Mahalanobis distance that I can see?