public class MatrixWeightedQuadraticDistanceFunction extends AbstractNumberVectorDistanceFunction implements Norm<NumberVector>
MahalanobisDistanceFunction.
For a weight matrix M, this distance is defined as
\[ \text{Mahalanobis}^2_M(\vec{x},\vec{y}) := (\vec{x}-\vec{y})^T * M *
(\vec{x}-\vec{y}) \]
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.| Modifier and Type | Field and Description |
|---|---|
protected double[][] |
weightMatrix
The weight matrix.
|
| Constructor and Description |
|---|
MatrixWeightedQuadraticDistanceFunction(double[][] weightMatrix)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
double |
distance(NumberVector o1,
NumberVector o2)
Computes the distance between two given DatabaseObjects according to this
distance function.
|
boolean |
equals(java.lang.Object obj) |
VectorFieldTypeInformation<? super NumberVector> |
getInputTypeRestriction()
Get the input data type of the function.
|
int |
hashCode() |
boolean |
isSquared()
Squared distances, that would become metric after square root.
|
double |
norm(NumberVector obj)
Compute the norm of object obj.
|
dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionalityclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitinstantiateisMetric, isSymmetricpublic MatrixWeightedQuadraticDistanceFunction(double[][] weightMatrix)
weightMatrix - weight matrixpublic double distance(NumberVector o1, NumberVector o2)
PrimitiveDistanceFunctiondistance in interface NumberVectorDistanceFunction<NumberVector>distance in interface PrimitiveDistanceFunction<NumberVector>o1 - first DatabaseObjecto2 - second DatabaseObjectpublic boolean isSquared()
DistanceFunctionisSquared in interface DistanceFunction<NumberVector>true when squared.public double norm(NumberVector obj)
Normnorm in interface Norm<NumberVector>obj - Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic VectorFieldTypeInformation<? super NumberVector> getInputTypeRestriction()
DistanceFunctiongetInputTypeRestriction in interface DistanceFunction<NumberVector>getInputTypeRestriction in interface PrimitiveDistanceFunction<NumberVector>getInputTypeRestriction in class AbstractNumberVectorDistanceFunctionCopyright © 2019 ELKI Development Team. License information.