os-fast-reservoir
快速近似水库采样的Python实现。
安装
$ pip install os-fast-reservoir
用法
原料药
from os_fast_reservoir import ReservoirSampling
rs = ReservoirSampling(100)
for i in range(1000):
rs.sample(i)
for i in rs:
print i
命令行
$ os-fast-reservoir -h
usage: os-fast-reservoir [-h] [-v] [-f FILES [FILES ...]] -n NUM
Reservoir sample tool.
optional arguments:
-h, --help
1