Package elki.distance.histogram
Class KolmogorovSmirnovDistance
- java.lang.Object
-
- elki.distance.AbstractNumberVectorDistance
-
- elki.distance.histogram.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKolmogorovSmirnovDistance.ParParameterization class, using the static instance.
-
Field Summary
Fields Modifier and Type Field Description static KolmogorovSmirnovDistanceSTATICStatic instance.
-
Constructor Summary
Constructors Constructor Description KolmogorovSmirnovDistance()Deprecated.Use static instance!
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubledistance(NumberVector v1, NumberVector v2)Computes the distance between two given vectors according to this distance function.booleanequals(java.lang.Object obj)inthashCode()java.lang.StringtoString()-
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, isSquared, isSymmetric
-
Methods inherited from interface elki.distance.PrimitiveDistance
instantiate
-
-
-
-
Field Detail
-
STATIC
public static final KolmogorovSmirnovDistance STATIC
Static instance. Use this!
-
-
Method Detail
-
distance
public double distance(NumberVector v1, NumberVector v2)
Description copied from interface:NumberVectorDistanceComputes 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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-