Class KolmogorovSmirnov

java.lang.Object
org.apache.datasketches.quantilescommon.KolmogorovSmirnov

public final class KolmogorovSmirnov extends Object
Kolmogorov-Smirnov Test See Kolmogorov–Smirnov Test
  • Constructor Details

    • KolmogorovSmirnov

      public KolmogorovSmirnov()
  • Method Details

    • 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 QuantilesDoublesAPI
      sketch2 - 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 sketch
      sketch2 - 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 sketch
      sketch2 - second Input QuantilesAPI sketch
      tgtPvalue - 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 QuantilesAPI
      sketch2 - second Input QuantilesAPI
      tgtPvalue - 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.