## Class WeightedSquaredPearsonCorrelationDistance

• All Implemented Interfaces:
Distance<NumberVector>, NumberVectorDistance<NumberVector>, PrimitiveDistance<NumberVector>, WeightedNumberVectorDistance<NumberVector>

public class WeightedSquaredPearsonCorrelationDistance
extends AbstractNumberVectorDistance
implements WeightedNumberVectorDistance<NumberVector>
Weighted 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).

This variation is for weighted dimensions.

Since:
0.4.0
Author:
Arthur Zimek, Erich Schubert
• ### Nested Class Summary

Nested Classes
Modifier and Type Class Description
static class  WeightedSquaredPearsonCorrelationDistance.Par
Parameterization class.
• ### Field Summary

Fields
Modifier and Type Field Description
private double[] weights
Weights
• ### Fields inherited from interface elki.distance.WeightedNumberVectorDistance

WEIGHTS_ID
• ### Constructor Summary

Constructors
Constructor Description
WeightedSquaredPearsonCorrelationDistance​(double[] weights)
Constructor.
• ### Method Summary

All 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()
• ### 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, toString, wait, wait, wait
• ### Methods inherited from interface elki.distance.Distance

isMetric, isSquared, isSymmetric
• ### Methods inherited from interface elki.distance.PrimitiveDistance

getInputTypeRestriction, instantiate
• ### Field Detail

• #### weights

private double[] weights
Weights
• ### Constructor Detail

• #### WeightedSquaredPearsonCorrelationDistance

public WeightedSquaredPearsonCorrelationDistance​(double[] weights)
Constructor.
Parameters:
weights - Weights
• ### 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.
Specified by:
distance in interface NumberVectorDistance<NumberVector>
Specified by:
distance in interface PrimitiveDistance<NumberVector>
Parameters:
v1 - first vector
v2 - second vector
Returns:
the distance between two given vectors according to this distance function
• #### 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