0.0
No commit activity in last 3 years
No release in over 3 years
Compute statistics on stream data
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
 Project Readme

StreamStats¶ ↑

<img src=“https://travis-ci.org/kadwanev/stream_stats.png” />

Extract statistics from long streams of data with minimal space usage and guaranteed precision.

Install¶ ↑

Add to Gemfile or gem install and require

gem 'stream_stats'
require 'stream_stats'

Usage¶ ↑

Stream Quantile Processing¶ ↑

Create stream and add values

stream = StreamStats::Stream.new(0.001, [0.50, 0.90])

Parameters:

1) precision level   
2) array of quantiles for guaranteed precision

The above example guarantees that the 50% and 90% percentile results are accurate to +/- 0.001.

Populate stream with samples:

(0..20).each do |i| 
  stream << i 
end

Get stream result whenever desired:

count       - count of stream entries
quantile    - query value at quantile
percentile  - query value at percentile
min         - query min value
max         - query max value
mean        - query mean
stddev      - query standard deviation of stream entries
sum         - query sum of stream entries
squared_sum - query squared sum of stream entries

Stream Counting¶ ↑

Create counter and add values

counter = StreamStats::Counter.new

Populate counter with samples:

(0..20).each do |i| 
  counter << i 
end

Get stream result whenever desired:

count       - count of stream entries
min         - query min value
max         - query max value
mean        - query mean
stddev      - query standard deviation of stream entries
sum         - query sum of stream entries
squared_sum - query squared sum of stream entries

Credit¶ ↑

Complete credit goes to Armon Dadgar.

Algorithm code copied directly out of [statsite](github.com/armon/statsite)