Package elki.distance

Class MahalanobisDistance

  • All Implemented Interfaces:
    Distance<NumberVector>, Norm<NumberVector>, NumberVectorDistance<NumberVector>, PrimitiveDistance<NumberVector>

    @Reference(authors="P. C. Mahalanobis",
               title="On the generalized distance in statistics",
               booktitle="Proceedings of the National Institute of Sciences of India. 2 (1)",
               bibkey="journals/misc/Mahalanobis36")
    public class MahalanobisDistance
    extends MatrixWeightedQuadraticDistance
    Mahalanobis quadratic form distance for feature vectors.

    For a weight matrix M, this distance is defined as \[ \text{Mahalanobis}_M(\vec{x},\vec{y}) := \sqrt{(\vec{x}-\vec{y})^T \cdot M \cdot (\vec{x}-\vec{y})} \]

    Reference:

    P. C. Mahalanobis
    On the generalized distance in statistics
    Proceedings of the National Institute of Sciences of India. 2 (1)

    This is the implementation as quadratic form distance function. In many cases it will be more convenient to use the static function VMath.mahalanobisDistance(double[][], double[], double[]) instead.

    TODO: Add a factory with parameterizable weight matrix! Right now, this can only be used from Java and from subclasses, not from command line or MiniGUI.

    Since:
    0.7.5
    Author:
    Erich Schubert