Package uk.ac.starlink.ttools.filter
Class GKQuantiler
java.lang.Object
uk.ac.starlink.ttools.filter.GKQuantiler
- All Implemented Interfaces:
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:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor with default accumulator.GKQuantiler
(GKArray gkArray) Constructor with custom accumulator. -
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptDatum
(double value) Accepts a value to accumulate for quantile calculations.void
addQuantiler
(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 onother
had been made on this one.double
getValueAtQuantile
(double quantile) Returns the value at a given quantile.void
ready()
Call after all data has been accumulated and before quantiles are to be calculated.
-
Field Details
-
DFLT_RANK_ACCURACY
public static final double DFLT_RANK_ACCURACYDefault rank accuracy.- See Also:
-
-
Constructor Details
-
GKQuantiler
public GKQuantiler()Constructor with default accumulator. -
GKQuantiler
Constructor with custom accumulator.
-
-
Method Details
-
acceptDatum
public void acceptDatum(double value) Description copied from interface:Quantiler
Accepts a value to accumulate for quantile calculations. NaN values are ignored.- Specified by:
acceptDatum
in interfaceQuantiler
- Parameters:
value
- value to accumulate
-
addQuantiler
Description copied from interface:Quantiler
Merges the state of another compatible accumulator into this one; the effect is as if all theQuantiler.acceptDatum(double)
calls that were made onother
had been made on this one.- Specified by:
addQuantiler
in interfaceQuantiler
- Parameters:
other
- compatible quantiler to merge with this
-
ready
public void ready()Description copied from interface:Quantiler
Call after all data has been accumulated and before quantiles are to be calculated. -
getValueAtQuantile
public double getValueAtQuantile(double quantile) Description copied from interface:Quantiler
Returns the value at a given quantile.- Specified by:
getValueAtQuantile
in interfaceQuantiler
- Parameters:
quantile
- value in the range 0..1- Returns:
- value at quantile, or NaN if no data
-