public class ExponentiallyDecayingReservoir extends Object implements Reservoir
longs. Uses Cormode et al's
forward-decaying priority reservoir sampling method to produce a statistically representative
sampling reservoir, exponentially biased towards newer entries.| 构造器和说明 |
|---|
ExponentiallyDecayingReservoir()
Creates a new
ExponentiallyDecayingReservoir of 1028 elements, which offers a 99.9%
confidence level with a 5% margin of error assuming a normal distribution, and an alpha
factor of 0.015, which heavily biases the reservoir to the past 5 minutes of measurements. |
ExponentiallyDecayingReservoir(Clock clock) |
ExponentiallyDecayingReservoir(int size,
double alpha)
Creates a new
ExponentiallyDecayingReservoir. |
ExponentiallyDecayingReservoir(int size,
double alpha,
Clock clock)
Creates a new
ExponentiallyDecayingReservoir. |
public ExponentiallyDecayingReservoir()
ExponentiallyDecayingReservoir of 1028 elements, which offers a 99.9%
confidence level with a 5% margin of error assuming a normal distribution, and an alpha
factor of 0.015, which heavily biases the reservoir to the past 5 minutes of measurements.public ExponentiallyDecayingReservoir(Clock clock)
public ExponentiallyDecayingReservoir(int size,
double alpha)
ExponentiallyDecayingReservoir.size - the number of samples to keep in the sampling reservoiralpha - the exponential decay factor; the higher this is, the more biased the reservoir
will be towards newer valuespublic ExponentiallyDecayingReservoir(int size,
double alpha,
Clock clock)
ExponentiallyDecayingReservoir.size - the number of samples to keep in the sampling reservoiralpha - the exponential decay factor; the higher this is, the more biased the reservoir
will be towards newer valuesclock - the clock used to timestamp samples and track rescalingpublic void update(long value,
long timestamp)
value - the value to be addedtimestamp - the epoch timestamp of value in secondspublic Snapshot getSnapshot()
getSnapshot 在接口中 ReservoirCopyright © 2019. All rights reserved.