 de.lmu.ifi.dbs.elki.distance.distancefunction.correlation

## Class SquaredPearsonCorrelationDistanceFunction

• All Implemented Interfaces:
DistanceFunction<NumberVector>, NumberVectorDistanceFunction<NumberVector>, PrimitiveDistanceFunction<NumberVector>

public class SquaredPearsonCorrelationDistanceFunction
extends AbstractNumberVectorDistanceFunction
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 and Description
static class  SquaredPearsonCorrelationDistanceFunction.Parameterizer
Parameterization class.
• ### Field Summary

Fields
Modifier and Type Field and Description
static SquaredPearsonCorrelationDistanceFunction STATIC
Static instance.
• ### Constructor Summary

Constructors
Constructor and Description
SquaredPearsonCorrelationDistanceFunction()
Deprecated.
use static instance!
• ### Method Summary

All Methods
Modifier and Type Method and 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 de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractNumberVectorDistanceFunction

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 de.lmu.ifi.dbs.elki.distance.distancefunction.PrimitiveDistanceFunction

instantiate
• ### Methods inherited from interface de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction

isMetric, isSymmetric
• ### Field Detail

• #### STATIC

public static final SquaredPearsonCorrelationDistanceFunction STATIC
Static instance.
• ### Constructor Detail

• #### SquaredPearsonCorrelationDistanceFunction

@Deprecated
public SquaredPearsonCorrelationDistanceFunction()
Deprecated. use static instance!
Constructor - use STATIC instead.
• ### Method Detail

• #### distance

public double distance(NumberVector v1,
NumberVector v2)
Description copied from interface: NumberVectorDistanceFunction
Computes the distance between two given vectors according to this distance function.
Parameters:
v1 - first vector
v2 - second vector
Returns:
the distance between two given vectors according to this distance function
• #### isSquared

public boolean isSquared()
Description copied from interface: DistanceFunction
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 class java.lang.Object
• #### equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
• #### hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object