Class 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
    • Constructor Detail

      • SquaredPearsonCorrelationDistance

        @Deprecated
        public SquaredPearsonCorrelationDistance()
        Deprecated.
        use static instance!
        Constructor - use STATIC 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 vector
        v2 - 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 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