@Alias(value="de.lmu.ifi.dbs.elki.distance.distancefunction.WeightedSquaredEuclideanDistanceFunction") public class WeightedSquaredEuclideanDistanceFunction extends AbstractNumberVectorDistanceFunction implements SpatialPrimitiveDistanceFunction<NumberVector>, WeightedNumberVectorDistanceFunction<NumberVector>, Norm<NumberVector>
NumberVectors. This results
in the same rankings as weighted Euclidean distance, but saves computing the
square root.
Weighted squared Euclidean is defined as: \[ \text{Euclidean}^2_{\vec{w}}(\vec{x},\vec{y}) := \sum_i w_i (x_i-y_i)^2 \]
| Modifier and Type | Class and Description |
|---|---|
static class |
WeightedSquaredEuclideanDistanceFunction.Parameterizer
Parameterization class.
|
| Modifier and Type | Field and Description |
|---|---|
protected double[] |
weights
Weight array
|
WEIGHTS_ID| Constructor and Description |
|---|
WeightedSquaredEuclideanDistanceFunction(double[] weights)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
double |
distance(NumberVector v1,
NumberVector v2)
Computes the distance between two given DatabaseObjects according to this
distance function.
|
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
boolean |
isSquared()
Squared distances, that would become metric after square root.
|
double |
minDist(SpatialComparable mbr1,
SpatialComparable mbr2)
Computes the distance between the two given MBRs according to this distance
function.
|
double |
norm(NumberVector obj)
Compute the norm of object obj.
|
dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, getInputTypeRestrictionclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitinstantiategetInputTypeRestrictionisMetric, isSymmetricpublic WeightedSquaredEuclideanDistanceFunction(double[] weights)
weights - Weight vectorpublic double distance(NumberVector v1, NumberVector v2)
PrimitiveDistanceFunctiondistance in interface NumberVectorDistanceFunction<NumberVector>distance in interface PrimitiveDistanceFunction<NumberVector>v1 - first DatabaseObjectv2 - second DatabaseObjectpublic double norm(NumberVector obj)
Normnorm in interface Norm<NumberVector>obj - Objectpublic double minDist(SpatialComparable mbr1, SpatialComparable mbr2)
SpatialPrimitiveDistanceFunctionminDist in interface SpatialPrimitiveDistanceFunction<NumberVector>mbr1 - the first MBR objectmbr2 - the second MBR objectpublic boolean isSquared()
DistanceFunctionisSquared in interface DistanceFunction<NumberVector>true when squared.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.ObjectCopyright © 2019 ELKI Development Team. License information.