Skip to content
Dynamic weighted sampling with replacement
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
compile.sh
fast_sampler.pyx
random_fast.cpp
run-tests.sh
sampler.py
setup.py
test_sampler.py

README.md

Weighted sampling with replacement, with dynamic weights

This code solves the problem of weighted sampling from a set, when you want to change the weight of a sample after you sample it. The implementation is described in the blog post here. The technique used is not novel, indeed it is based on publications from the 1960s.

A Cython implementation is provided along with the regular Python implementation.

Requires numpy and py.test packages.

You can’t perform that action at this time.