Ruby Implementation of Graham Cormode and S. Muthukrishnan's Effective Computation of Biased Quantiles over Data Streams in ICDE’05.
gem install quantile
require 'quantile'
estimator = Quantile::Estimator.new
# Record any amount of Numeric values
10_000.times do
estimator.observe(rand)
end
# Retrieve the value of a given quantile
estimator.query(0.5)
# Retrieve the number of observations
estimator.observations
# Get the sum of all observed values.
estimator.sum
# Install dependencies
gem install bundler
bundle install
# Run tests
rake test
Matt T. Proud <[email protected]>