Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Python implementation of fast approximation reservioir sampling.

Project Description
# os-fast-reservoir
[![Build Status](https://www.travis-ci.org/cfhamlet/os-fast-reservoir.svg?branch=master)](https://www.travis-ci.org/cfhamlet/os-fast-reservoir)
[![codecov](https://codecov.io/gh/cfhamlet/os-fast-reservoir/branch/master/graph/badge.svg)](https://codecov.io/gh/cfhamlet/os-fast-reservoir)

Python implementation of fast approximation reservioir sampling.

# Install
`$ pip install os-fast-reservoir`

# Usage
* API
```
from os_fast_reservoir import ReservoirSampling

rs = ReservoirSampling(100)

for i in range(1000):
rs.sample(i)

for i in rs:
print i
```
* Command line
```
$ os-fast-reservoir -h
usage: os-fast-reservoir [-h] [-f INPUT_FILE] -n NUM

Reservoir sample tool.

optional arguments:
-h, --help show this help message and exit
-f INPUT_FILE, --file INPUT_FILE
file to be sampled (default: stdin)
-n NUM, --num NUM sample number
```

# Algorithm
* [Reservoir sampling](https://en.wikipedia.org/wiki/Reservoir_sampling)
* [Faster Random Samples With Gap Sampling](http://erikerlandson.github.io/blog/2014/09/11/faster-random-samples-with-gap-sampling/)
* [Very Fast Reservoir Sampling](http://erikerlandson.github.io/blog/2015/11/20/very-fast-reservoir-sampling/)
* Implementation: [alexprengere/reservoir](https://github.com/alexprengere/reservoir)

# Unit Tests
`$ tox`

# License
MIT licensed.
Release History

Release History

This version
History Node

0.1.1

History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
os-fast-reservoir-0.1.1.tar.gz (4.5 kB) Copy SHA256 Checksum SHA256 Source Jul 21, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting