Day 33: Reservoir sampling
Reservoir sampling is super useful when there is an endless stream of data and your goal is to grab a small sample with uniform probability.
The math behind is straightforward. Given a sample of size K
with N
items processed so far, the chance for any item…