Class KolmogorovSmirnovDistance

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

    public class KolmogorovSmirnovDistance
    extends AbstractNumberVectorDistance
    Distance function based on the Kolmogorov-Smirnov goodness of fit test.

    This distance function assumes there exist a natural order in the vectors, i.e. they should be some 1-dimensional histogram.

    The distance is then defined as \[\text{KS}(\vec{x},\vec{y}) := \max_i |\frac{\sum_{j=1}^i x_j}{\sum_{j=1}^d x_j}| - |\frac{\sum_{j=1}^i y_j}{\sum_{j=1}^d y_j}| \] which is the maximum difference of the empirical CDFs, where the divisors normalize the distribution to 1.

    Since:
    0.6.0
    Author:
    Erich Schubert
    • Constructor Detail

      • KolmogorovSmirnovDistance

        @Deprecated
        public KolmogorovSmirnovDistance()
        Deprecated.
        Use static instance!
        Constructor for the Kolmogorov-Smirnov distance function.
    • 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
      • 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