Skip to content

Documentation of Efraimidis-Spirakis samplers #254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/source/sampling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,27 @@ All following functions write results to ``x`` (pre-allocated) and return ``x``.
It makes a copy of the weight vector at initialization, and sets the weight to zero when the corresponding sample is picked.

This algorithm consumes ``O(k)`` random numbers, and has overall time complexity ``O(n k)``.

.. function:: efraimidis_a_wsample_norep!([rng], a, wv, x)

Implementation of weighted sampling without replacement using Efraimidis-Spirakis A algorithm.

Reference: Efraimidis, P. S., Spirakis, P. G. *Weighted random sampling with a reservoir.* Information Processing Letters, 97 (5), 181-185, 2006.

This algorithm takes ``O(n + k log k)`` processing time to draw ``k`` elements. It consumes ``n`` random numbers.

.. function:: efraimidis_ares_wsample_norep!([rng], a, wv, x)

Implementation of weighted sampling without replacement using Efraimidis-Spirakis A-Res algorithm.

Reference: Efraimidis, P. S., Spirakis, P. G. *Weighted random sampling with a reservoir.* Information Processing Letters, 97 (5), 181-185, 2006.

This algorithm takes ``O(k log(k) log(n / k))`` processing time to draw ``k`` elements. It consumes ``n`` random numbers.

.. function:: efraimidis_aexpj_wsample_norep!([rng], a, wv, x)

Implementation of weighted sampling without replacement using Efraimidis-Spirakis A-ExpJ algorithm.

Reference: Efraimidis, P. S., Spirakis, P. G. *Weighted random sampling with a reservoir.* Information Processing Letters, 97 (5), 181-185, 2006.

This algorithm takes ``O(k log(k) log(n / k))`` processing time to draw ``k`` elements. It consumes ``O(k log(n / k))`` random numbers.