Class UnknownDoubleQuantileEstimator
java.lang.Object
cern.colt.PersistentObject
cern.jet.stat.quantile.DoubleQuantileEstimator
cern.jet.stat.quantile.UnknownDoubleQuantileEstimator
- All Implemented Interfaces:
DoubleQuantileFinder, Serializable, Cloneable
Approximate quantile finding algorithm for unknown N requiring only one pass and little main memory; computes quantiles over a sequence of double elements.
This algorithm requires at most two times the memory of a corresponding approx. quantile finder knowing N.
1. quantiles - the number of quantiles to be computed.
2. epsilon - the allowed approximation error on quantiles. The approximation guarantee of this algorithm is explicit.
3. delta - the probability allowed that the approximation error fails to be smaller than epsilon. Set delta to zero for explicit non probabilistic guarantees.
You usually don't instantiate quantile finders by using the constructor. Instead use the factory QuantileFinderFactor to do so. It will set up the right parametrization for you.
Needs as input the following parameters:
It is also possible to couple the approximation algorithm with random sampling to further reduce memory requirements. With sampling, the approximation guarantees are explicit but probabilistic, i.e. they apply with respect to a (user controlled) confidence parameter "delta".
After Gurmeet Singh Manku, Sridhar Rajagopalan and Bruce G. Lindsay, Random Sampling Techniques for Space Efficient Online Computation of Order Statistics of Large Datasets. Accepted for Proc. of the 1999 ACM SIGMOD Int. Conf. on Management of Data, Paper (soon) available here.
- Version:
- 1.0, 09/24/99
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected doubleprotected WeightedRandomSamplerprotected final intFields inherited from class DoubleQuantileEstimator
bufferSet, currentBufferToFill, totalElementsFilledFields inherited from class PersistentObject
serialVersionUID -
Constructor Summary
ConstructorsConstructorDescriptionUnknownDoubleQuantileEstimator(int b, int k, int h, double precomputeEpsilon, RandomEngine generator) Constructs an approximate quantile finder with b buffers, each having k elements. -
Method Summary
Modifier and TypeMethodDescriptionprotected DoubleBuffer[]Not yet commented.voidclear()Removes all elements from the receiver.clone()Returns a deep copy of the receiver.protected voidNot yet commented.protected voidpostCollapse(DoubleBuffer[] toCollapse) Not yet commented.Computes the specified quantile elements over the values previously added.protected booleanNot yet commented.protected static voidsortAscendingByLevel(DoubleBuffer[] fullBuffers) To do.toString()Returns a String representation of the receiver.Methods inherited from class DoubleQuantileEstimator
add, addAllOf, addAllOfFromTo, collapse, contains, forEach, memory, phi, preProcessPhis, setUp, size, totalMemory
-
Field Details
-
currentTreeHeight
protected int currentTreeHeight -
treeHeightStartingSampling
protected final int treeHeightStartingSampling -
sampler
-
precomputeEpsilon
protected double precomputeEpsilon
-
-
Constructor Details
-
UnknownDoubleQuantileEstimator
public UnknownDoubleQuantileEstimator(int b, int k, int h, double precomputeEpsilon, RandomEngine generator) Constructs an approximate quantile finder with b buffers, each having k elements.- Parameters:
b- the number of buffersk- the number of elements per bufferh- the tree height at which sampling shall start.precomputeEpsilon- the epsilon for which quantiles shall be precomputed; set this value invalid input: '<'=0.0 if nothing shall be precomputed.generator- a uniform random number generator.
-
-
Method Details
-
buffersToCollapse
Not yet commented.- Overrides:
buffersToCollapsein classDoubleQuantileEstimator
-
clear
public void clear()Removes all elements from the receiver. The receiver will be empty after this call returns, and its memory requirements will be close to zero.- Specified by:
clearin interfaceDoubleQuantileFinder- Overrides:
clearin classDoubleQuantileEstimator
-
clone
Returns a deep copy of the receiver.- Specified by:
clonein interfaceDoubleQuantileFinder- Overrides:
clonein classDoubleQuantileEstimator- Returns:
- a deep copy of the receiver.
-
newBuffer
protected void newBuffer()Not yet commented.- Specified by:
newBufferin classDoubleQuantileEstimator
-
postCollapse
Not yet commented.- Specified by:
postCollapsein classDoubleQuantileEstimator
-
quantileElements
Computes the specified quantile elements over the values previously added.- Specified by:
quantileElementsin interfaceDoubleQuantileFinder- Overrides:
quantileElementsin classDoubleQuantileEstimator- Parameters:
phis- the quantiles for which elements are to be computed. Each phi must be in the interval (0.0,1.0]. phis must be sorted ascending.- Returns:
- the approximate quantile elements.
-
sampleNextElement
protected boolean sampleNextElement()Not yet commented.- Specified by:
sampleNextElementin classDoubleQuantileEstimator
-
sortAscendingByLevel
To do. This could faster be done without sorting (min and second min). -
toString
Returns a String representation of the receiver.- Overrides:
toStringin classDoubleQuantileEstimator
-