Did I find the right examples for you? yes no

# greplin.scales.samplestats.ExponentiallyDecayingReservoir

All Samples(10)  |  Call(6)  |  Derive(0)  |  Import(4)
```An exponentially-decaying random reservoir of. Uses Cormode et al's
forward-decaying priority reservoir sampling method to produce a statistically representative
sampling reservoir, exponentially biased towards newer entries.

`Cormode et al. Forward Decay: A Practical Time Decay Model for Streaming Systems. ICDE '09
http://dimacs.rutgers.edu/~graham/pubs/papers/fwddecay.pdf`

This is a straight transliteration of the Yammer metrics version from java to python, whilst
staring gently at the Cormode paper.
```

src/s/c/scales-1.0.6/src/greplin/scales/samplestats_test.py   scales(Download)
```"""Sample statistics tests."""

from greplin.scales.samplestats import UniformSample, ExponentiallyDecayingReservoir
import random
import unittest
```
```  def testGaussian(self):
"""Test with gaussian random numbers."""
random.seed(42)

sample = ExponentiallyDecayingReservoir()
```
```    random.seed(42)

sample = ExponentiallyDecayingReservoir(rescale_threshold=-1)
sample.update(random.gauss(42.0, 13.0))
self.assertAlmostEqual(sample.mean, 40.12682571548693, places=5)
```

src/s/c/scales-HEAD/src/greplin/scales/samplestats_test.py   scales(Download)
```"""Sample statistics tests."""

from greplin.scales.samplestats import UniformSample, ExponentiallyDecayingReservoir
import random
import unittest
```
```  def testGaussian(self):
"""Test with gaussian random numbers."""
random.seed(42)

sample = ExponentiallyDecayingReservoir()
```
```    random.seed(42)

sample = ExponentiallyDecayingReservoir(rescale_threshold=-1)
sample.update(random.gauss(42.0, 13.0))
self.assertAlmostEqual(sample.mean, 40.12682571548693, places=5)
```

src/s/c/scales-1.0.6/src/greplin/scales/__init__.py   scales(Download)
```except ImportError:
from collections import UserDict
from greplin.scales.samplestats import ExponentiallyDecayingReservoir

ID_KEY = '__STATS__id'
```
```        self.__sample = sample
else:
self.__sample = ExponentiallyDecayingReservoir()
self.__timestamp = 0
self.percentile99 = None
```

src/s/c/scales-HEAD/src/greplin/scales/__init__.py   scales(Download)
```except ImportError:
from collections import UserDict
from greplin.scales.samplestats import ExponentiallyDecayingReservoir

ID_KEY = '__STATS__id'
```
```        self.__sample = sample
else:
self.__sample = ExponentiallyDecayingReservoir()
self.__timestamp = 0
self.percentile99 = None
```