at.tuwien.ifs.somtoolbox.layers.metrics
Class MahalanobisMetric
java.lang.Object
at.tuwien.ifs.somtoolbox.layers.metrics.AbstractMetric
at.tuwien.ifs.somtoolbox.layers.metrics.MahalanobisMetric
- All Implemented Interfaces:
- DistanceMetric, Comparable<DistanceMetric>
public class MahalanobisMetric
- extends AbstractMetric
Implements the Mahalanobis distance metric. This metric requires the covariance matrix of the input data to be
pre-calculated and set via the init(double[][]) method prior to calculating distances.
- Version:
- $Id: MahalanobisMetric.java 3583 2010-05-21 10:07:41Z mayer $
- Author:
- Rudolf Mayer
|
Method Summary |
double |
distance(double[] vector1,
double[] vector2)
Calculates the distance between two vectors provided by argument vector1 and vector2. |
void |
init(double[][] covarianceMatrix)
|
| Methods inherited from class at.tuwien.ifs.somtoolbox.layers.metrics.AbstractMetric |
checkDimensions, checkDimensions, compareTo, distance, distance, distance, distance, distance, distance, distance, distance, instantiate, instantiateNice, meanVector, performanceTest, setMetricParams, transformValue, transformVector |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
covarianceMatrix
double[][] covarianceMatrix
MahalanobisMetric
public MahalanobisMetric()
init
public void init(double[][] covarianceMatrix)
distance
public double distance(double[] vector1,
double[] vector2)
throws MetricException
- Description copied from interface:
DistanceMetric
- Calculates the distance between two vectors provided by argument
vector1 and vector2. A
MetricException is thrown, if the dimensionalities of the two vectors differ.
- Specified by:
distance in interface DistanceMetric- Specified by:
distance in class AbstractMetric
- Parameters:
vector1 - first vector.vector2 - second vector.
- Returns:
- the distance between
vector1 and vector2.
- Throws:
MetricException - if the dimensionalities of the two vectors differ.- See Also:
DistanceMetric.distance(double[], double[])