|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.solr.util.stats.ExponentiallyDecayingSample
public class ExponentiallyDecayingSample
An exponentially-decaying random sample of long
s. Uses Cormode et al's forward-decaying
priority reservoir sampling method to produce a statistically representative sample,
exponentially biased towards newer entries.
See
Cormode et al. Forward Decay: A Practical Time Decay Model for Streaming Systems. ICDE '09: Proceedings of the 2009 IEEE International Conference on Data Engineering (2009)
Constructor Summary | |
---|---|
ExponentiallyDecayingSample(int reservoirSize,
double alpha)
Creates a new ExponentiallyDecayingSample . |
|
ExponentiallyDecayingSample(int reservoirSize,
double alpha,
Clock clock)
Creates a new ExponentiallyDecayingSample . |
Method Summary | |
---|---|
void |
clear()
Clears all recorded values. |
Snapshot |
getSnapshot()
Returns a snapshot of the sample's values. |
int |
size()
Returns the number of values recorded. |
void |
update(long value)
Adds a new recorded value to the sample. |
void |
update(long value,
long timestamp)
Adds an old value with a fixed timestamp to the sample. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExponentiallyDecayingSample(int reservoirSize, double alpha)
ExponentiallyDecayingSample
.
reservoirSize
- the number of samples to keep in the sampling reservoiralpha
- the exponential decay factor; the higher this is, the more biased the
sample will be towards newer valuespublic ExponentiallyDecayingSample(int reservoirSize, double alpha, Clock clock)
ExponentiallyDecayingSample
.
reservoirSize
- the number of samples to keep in the sampling reservoiralpha
- the exponential decay factor; the higher this is, the more biased the
sample will be towards newer valuesMethod Detail |
---|
public void clear()
Sample
clear
in interface Sample
public int size()
Sample
size
in interface Sample
public void update(long value)
Sample
update
in interface Sample
value
- a new recorded valuepublic void update(long value, long timestamp)
value
- the value to be addedtimestamp
- the epoch timestamp of value
in secondspublic Snapshot getSnapshot()
Sample
getSnapshot
in interface Sample
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |