Class BoundsOnRatiosInTupleSketchedSets

java.lang.Object
org.apache.datasketches.thetacommon.BoundsOnRatiosInTupleSketchedSets

public final class BoundsOnRatiosInTupleSketchedSets extends Object
This class is used to compute the bounds on the estimate of the ratio B / A, where:
  • A is a Tuple Sketch of population PopA.
  • B is a Tuple or Theta Sketch of population PopB that is a subset of A, obtained by an intersection of A with some other Tuple or Theta Sketch C, which acts like a predicate or selection clause.
  • The estimate of the ratio PopB/PopA is BoundsOnRatiosInThetaSketchedSets.getEstimateOfBoverA(A, B).
  • The Upper Bound estimate on the ratio PopB/PopA is BoundsOnRatiosInThetaSketchedSets.getUpperBoundForBoverA(A, B).
  • The Lower Bound estimate on the ratio PopB/PopA is BoundsOnRatiosInThetaSketchedSets.getLowerBoundForBoverA(A, B).
Note: The theta of A cannot be greater than the theta of B. If B is formed as an intersection of A and some other set C, then the theta of B is guaranteed to be less than or equal to the theta of B.
Author:
Kevin Lang, Lee Rhodes, David Cromberge
  • Method Details

    • getLowerBoundForBoverA

      public static <S extends Summary> double getLowerBoundForBoverA(Sketch<S> sketchA, Sketch<S> sketchB)
      Gets the approximate lower bound for B over A based on a 95% confidence interval
      Type Parameters:
      S - Summary
      Parameters:
      sketchA - the Tuple sketch A with summary type S
      sketchB - the Tuple sketch B with summary type S
      Returns:
      the approximate lower bound for B over A
    • getLowerBoundForBoverA

      public static <S extends Summary> double getLowerBoundForBoverA(Sketch<S> sketchA, Sketch sketchB)
      Gets the approximate lower bound for B over A based on a 95% confidence interval
      Type Parameters:
      S - Summary
      Parameters:
      sketchA - the Tuple sketch A with summary type S
      sketchB - the Theta sketch B
      Returns:
      the approximate lower bound for B over A
    • getUpperBoundForBoverA

      public static <S extends Summary> double getUpperBoundForBoverA(Sketch<S> sketchA, Sketch<S> sketchB)
      Gets the approximate upper bound for B over A based on a 95% confidence interval
      Type Parameters:
      S - Summary
      Parameters:
      sketchA - the Tuple sketch A with summary type S
      sketchB - the Tuple sketch B with summary type S
      Returns:
      the approximate upper bound for B over A
    • getUpperBoundForBoverA

      public static <S extends Summary> double getUpperBoundForBoverA(Sketch<S> sketchA, Sketch sketchB)
      Gets the approximate upper bound for B over A based on a 95% confidence interval
      Type Parameters:
      S - Summary
      Parameters:
      sketchA - the Tuple sketch A with summary type S
      sketchB - the Theta sketch B
      Returns:
      the approximate upper bound for B over A
    • getEstimateOfBoverA

      public static <S extends Summary> double getEstimateOfBoverA(Sketch<S> sketchA, Sketch<S> sketchB)
      Gets the estimate for B over A
      Type Parameters:
      S - Summary
      Parameters:
      sketchA - the Tuple sketch A with summary type S
      sketchB - the Tuple sketch B with summary type S
      Returns:
      the estimate for B over A
    • getEstimateOfBoverA

      public static <S extends Summary> double getEstimateOfBoverA(Sketch<S> sketchA, Sketch sketchB)
      Gets the estimate for B over A
      Type Parameters:
      S - Summary
      Parameters:
      sketchA - the Tuple sketch A with summary type S
      sketchB - the Theta sketch B
      Returns:
      the estimate for B over A