Struct pdatastructs::ReservoirSampling [] [src]

pub struct ReservoirSampling<T, R> where
    R: Rng
{ /* fields omitted */ }

Simple implementation of Reservoir Sampling with fast approximation

Methods

impl<T, R> ReservoirSampling<T, R> where
    R: Rng
[src]

[src]

Create new reservoir sampler that keeps k samples and uses rng for its random decisions.

[src]

Number of samples that should be kept.

[src]

Read-only copy of the reservoir. Contains at most k entries.

[src]

Number of data points seen.

[src]

Observe new data point.

[src]

Checks if reservoir is empty (i.e. no data points where observed)

[src]

Clear sampler state. It now behaves like a fresh one (i.e. no data points seen so far).

Trait Implementations

impl<T: Clone, R: Clone> Clone for ReservoirSampling<T, R> where
    R: Rng
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T, R> Debug for ReservoirSampling<T, R> where
    R: Rng
[src]

[src]

Formats the value using the given formatter.

impl<T, R> Extend<T> for ReservoirSampling<T, R> where
    R: Rng
[src]

[src]

Extends a collection with the contents of an iterator. Read more