Rosetta Utilities  2014.35
Classes | Namespaces | Functions
reservoir_sample.hh File Reference

Randomly select the best N elements from a stream of elements using one pass over a dataset. More...

#include <numeric/types.hh>
#include <numeric/random/random.hh>
#include <utility/vector1.hh>

Classes

class  numeric::random::ReservoirSampler< T >
 Simple container for keeping K random values. More...
 

Namespaces

 numeric
 Unit headers.
 
 numeric::random
 

Functions

numeric::Real numeric::random::reservoir_sample_accept_prob (numeric::Size n_wanted, numeric::Size const n_seen)
 Returns the probability that the Nth value in a sequence should be accepted using the reservoir sampling criterion. More...
 
template<typename T >
utility::vector1< T > numeric::random::reservoir_sample (utility::vector1< T > const &vec, numeric::Size const n_wanted, RandomGenerator &rg)
 

Detailed Description

Randomly select the best N elements from a stream of elements using one pass over a dataset.

Detailed:
Author
James Thompson