Package elki.distance.correlation
Class SquaredPearsonCorrelationDistance
- java.lang.Object
-
- elki.distance.AbstractNumberVectorDistance
-
- elki.distance.correlation.SquaredPearsonCorrelationDistance
-
- All Implemented Interfaces:
Distance<NumberVector>
,NumberVectorDistance<NumberVector>
,PrimitiveDistance<NumberVector>
public class SquaredPearsonCorrelationDistance extends AbstractNumberVectorDistance
Squared Pearson correlation distance function for feature vectors.The squared Pearson correlation distance is computed from the Pearson correlation coefficient \(r\) as: \(1-r^2\). Hence, possible values of this distance are between 0 and 1.
The distance between two vectors will be low (near 0), if their attribute values are dimension-wise strictly positively or negatively correlated. For features with uncorrelated attributes, the distance value will be high (near 1).
- Since:
- 0.3
- Author:
- Arthur Zimek
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SquaredPearsonCorrelationDistance.Par
Parameterization class.
-
Field Summary
Fields Modifier and Type Field Description static SquaredPearsonCorrelationDistance
STATIC
Static instance.
-
Constructor Summary
Constructors Constructor Description SquaredPearsonCorrelationDistance()
Deprecated.use static instance!
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
distance(NumberVector v1, NumberVector v2)
Computes the distance between two given vectors according to this distance function.boolean
equals(java.lang.Object obj)
int
hashCode()
boolean
isSquared()
Squared distances, that would become metric after square root.java.lang.String
toString()
-
Methods inherited from class elki.distance.AbstractNumberVectorDistance
dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, dimensionality, getInputTypeRestriction
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface elki.distance.Distance
isMetric, isSymmetric
-
Methods inherited from interface elki.distance.PrimitiveDistance
instantiate
-
-
-
-
Field Detail
-
STATIC
public static final SquaredPearsonCorrelationDistance STATIC
Static instance.
-
-
Constructor Detail
-
SquaredPearsonCorrelationDistance
@Deprecated public SquaredPearsonCorrelationDistance()
Deprecated.use static instance!Constructor - useSTATIC
instead.
-
-
Method Detail
-
distance
public double distance(NumberVector v1, NumberVector v2)
Description copied from interface:NumberVectorDistance
Computes the distance between two given vectors according to this distance function.- Parameters:
v1
- first vectorv2
- second vector- Returns:
- the distance between two given vectors according to this distance function
-
isSquared
public boolean isSquared()
Description copied from interface:Distance
Squared distances, that would become metric after square root.E.g. squared Euclidean.
- Returns:
true
when squared.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-