Package uk.ac.starlink.ttools.filter
Class GKQuantiler
- java.lang.Object
-
- uk.ac.starlink.ttools.filter.GKQuantiler
-
- All Implemented Interfaces:
Quantiler
public class GKQuantiler extends java.lang.Object implements Quantiler
Quantiler based on the method of Greenwald and Kanna, via the implementation in https://github.com/DataDog/sketches-java. It's not that fast and not that accurate, but it can cope with any number of samples.- Since:
- 3 Dec 2020
- Author:
- Mark Taylor
- See Also:
- Greenwald and Kanna paper
-
-
Field Summary
Fields Modifier and Type Field Description static doubleDFLT_RANK_ACCURACYDefault rank accuracy.
-
Constructor Summary
Constructors Constructor Description GKQuantiler()Constructor with default accumulator.GKQuantiler(GKArray gkArray)Constructor with custom accumulator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacceptDatum(double value)Accepts a value to accumulate for quantile calculations.voidaddQuantiler(Quantiler other)Merges the state of another compatible accumulator into this one; the effect is as if all theQuantiler.acceptDatum(double)calls that were made onotherhad been made on this one.doublegetValueAtQuantile(double quantile)Returns the value at a given quantile.voidready()Call after all data has been accumulated and before quantiles are to be calculated.
-
-
-
Field Detail
-
DFLT_RANK_ACCURACY
public static final double DFLT_RANK_ACCURACY
Default rank accuracy.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GKQuantiler
public GKQuantiler()
Constructor with default accumulator.
-
GKQuantiler
public GKQuantiler(GKArray gkArray)
Constructor with custom accumulator.
-
-
Method Detail
-
acceptDatum
public void acceptDatum(double value)
Description copied from interface:QuantilerAccepts a value to accumulate for quantile calculations. NaN values are ignored.- Specified by:
acceptDatumin interfaceQuantiler- Parameters:
value- value to accumulate
-
addQuantiler
public void addQuantiler(Quantiler other)
Description copied from interface:QuantilerMerges the state of another compatible accumulator into this one; the effect is as if all theQuantiler.acceptDatum(double)calls that were made onotherhad been made on this one.- Specified by:
addQuantilerin interfaceQuantiler- Parameters:
other- compatible quantiler to merge with this
-
ready
public void ready()
Description copied from interface:QuantilerCall after all data has been accumulated and before quantiles are to be calculated.
-
getValueAtQuantile
public double getValueAtQuantile(double quantile)
Description copied from interface:QuantilerReturns the value at a given quantile.- Specified by:
getValueAtQuantilein interfaceQuantiler- Parameters:
quantile- value in the range 0..1- Returns:
- value at quantile, or NaN if no data
-
-