The Mahalanobis distance is used in recognition tasks, as it tells how far a point (a test pattern in feature space) is from a cluster of patterns (a class). A cluster of patterns defining a class is described by its average vector (centroid) and its covariance matrix,
where the sums range over the patterns (index j) in the cluster.
The Mahalanobis distance of the point P from the cluster C={m,s} is
Suppose to have changed the frame of reference so that the covariance is diagonal, ie, to have transformed the sample vectors by the matrix T that diagonalizes the covariance s. Let hj be the eigenvalues of s and ej the corresponding eigenvectors. The values hj are the squared standard deviations of the distribution. Thus, in the new frame of reference the covariance is
The Mahalanibis distance in the new frame of reference is
Let u be the center (centroid) of the distribution. A new "center" m is chosen according to the distribution of the sample components along the eigenvalues. For each j let
hj+ | = | (1/N+) ∑ [ (x | ej) - mj ]2 |
hj- | = | (1/N-) ∑ [ (x | ej) - mj ]2 |
The eigenvalus estimated from a finite number of samples usually contain errors, and this is likely to reduce the recognition rate. One way to take this into account is to restrict tha summations to the samples that lie within a fixed distance (proportional to the eigenvalues hj) from the center (u or m whichever is available).
The asymmetric Mahalanobis distance is now
Finally the distance can be further modified by adding a bias b to the variances in the denominators: