Class KolmogorovSmirnov
- java.lang.Object
-
- org.apache.datasketches.quantilescommon.KolmogorovSmirnov
-
public final class KolmogorovSmirnov extends Object
Kolmogorov-Smirnov Test See Kolmogorov–Smirnov Test
-
-
Constructor Summary
Constructors Constructor Description KolmogorovSmirnov()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
computeKSDelta(QuantilesDoublesAPI sketch1, QuantilesDoublesAPI sketch2)
Computes the raw delta between two QuantilesDoublesAPI sketches for the kolmogorovSmirnovTest(...) method.static double
computeKSDelta(QuantilesFloatsAPI sketch1, QuantilesFloatsAPI sketch2)
Computes the raw delta between two QuantilesFloatsAPI sketches for the kolmogorovSmirnovTest(...) method.static double
computeKSThreshold(QuantilesAPI sketch1, QuantilesAPI sketch2, double tgtPvalue)
Computes the adjusted delta height threshold for the kolmogorovSmirnovTest(...) method.static boolean
kolmogorovSmirnovTest(QuantilesAPI sketch1, QuantilesAPI sketch2, double tgtPvalue)
Performs the Kolmogorov-Smirnov Test between two QuantilesAPI sketches.
-
-
-
Method Detail
-
computeKSDelta
public static double computeKSDelta(QuantilesDoublesAPI sketch1, QuantilesDoublesAPI sketch2)
Computes the raw delta between two QuantilesDoublesAPI sketches for the kolmogorovSmirnovTest(...) method.- Parameters:
sketch1
- first Input QuantilesDoublesAPIsketch2
- second Input QuantilesDoublesAPI- Returns:
- the raw delta area between two QuantilesDoublesAPI sketches
-
computeKSDelta
public static double computeKSDelta(QuantilesFloatsAPI sketch1, QuantilesFloatsAPI sketch2)
Computes the raw delta between two QuantilesFloatsAPI sketches for the kolmogorovSmirnovTest(...) method. method.- Parameters:
sketch1
- first Input QuantilesFloatsAPI sketchsketch2
- second Input QuantilesFloatsAPI sketch- Returns:
- the raw delta area between two QuantilesFloatsAPI sketches
-
computeKSThreshold
public static double computeKSThreshold(QuantilesAPI sketch1, QuantilesAPI sketch2, double tgtPvalue)
Computes the adjusted delta height threshold for the kolmogorovSmirnovTest(...) method. This adjusts the computed threshold by the error epsilons of the two given sketches. The two sketches must be of the same primitive type, double or float. This will not work with the REQ sketch.- Parameters:
sketch1
- first Input QuantilesAPI sketchsketch2
- second Input QuantilesAPI sketchtgtPvalue
- Target p-value. Typically .001 to .1, e.g., .05.- Returns:
- the adjusted threshold to be compared with the raw delta area.
-
kolmogorovSmirnovTest
public static boolean kolmogorovSmirnovTest(QuantilesAPI sketch1, QuantilesAPI sketch2, double tgtPvalue)
Performs the Kolmogorov-Smirnov Test between two QuantilesAPI sketches. Note: if the given sketches have insufficient data or if the sketch sizes are too small, this will return false. The two sketches must be of the same primitive type, double or float. This will not work with the REQ sketch.- Parameters:
sketch1
- first Input QuantilesAPIsketch2
- second Input QuantilesAPItgtPvalue
- Target p-value. Typically .001 to .1, e.g., .05.- Returns:
- Boolean indicating whether we can reject the null hypothesis (that the sketches reflect the same underlying distribution) using the provided tgtPValue.
-
-