How to use mahalanobis distance in sklearn DistanceMetrics?
<p>Perhaps this is elementary, but I cannot find a good example of using <code>mahalanobis</code> distance in <code>sklearn</code>.  </p>

<p>I can't even get the metric like this:</p>

<pre><code>from sklearn.neighbors import DistanceMetric
DistanceMetric.get_metric('mahalanobis')
</code></pre>

<p>This throws an error:  <code>TypeError: 0-dimensional array given.  Array must be at least two-dimensional</code>.</p>

<p>But, I can't even seem to get it to take an array:</p>

<pre><code>DistanceMetric.get_metric('mahalanobis', [[0.5],[0.7]])
</code></pre>

<p>throws:  </p>

<pre><code>TypeError: get_metric() takes exactly 1 positional argument (2 given)
</code></pre>

<p>I checked out the docs <a href="http://scikit-learn.org/stable/modules/generated/sklearn.neighbors.DistanceMetric.html" rel="noreferrer">here</a> and <a href="http://scikit-learn.org/stable/modules/generated/sklearn.neighbors.DistanceMetric.html" rel="noreferrer">here</a>.  But, I don't see what types of arguments it is expecting.<br>
Is there an example of using the Mahalanobis distance that I can see?</p>