Produce an enumerated stream like [(0,a), (1,a),…, (capacity, b), …, (stream_length-1, b)] with capacity copies of “a”
(aka initial_values) and stream_length total values.
Utility function used in examples showing convergence of reservoir mean to stream mean.
Utility Functions for Reservoir Sampling
Produce a stream like [a, …, a, b, …, b] with num_of_initial_values copies of “a”
(aka initial_values) and stream_length total values.
Utility function used in examples showing convergence of reservoir mean to stream mean.
A stream of 100 weighted datum is generated using generate_step_stream. The first
50 items have value 0 and the remaining 50 have value 1. All weights are set to 1.
The mean of a reservoir sample with capacity equal to half the stream length is computed
and stored. This is repeated 50 times and the mean of the means is returned.