Skip to content
/ winstat Public

Online second-order statistics in sliding window

Notifications You must be signed in to change notification settings

dgtony/winstat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

winstat - statistics in window

Computing second-order statistics online in the sliding window. Package provides utility to efficiently generate instant basic statistics, such as a mean and standard deviation for sliding window in the online manner.

Usage

To start computing statistics you need at first to create a StatWindow with a reasonable window size (greater than one). After that you can add new values to the buffer one-by-one as they arrive and get instant statistics for the given window in return.

use winstat::StatWindow;

// static window for 5 elements
let window_size = 5;

// create estimator
let mut sw = StatWindow::new(window_size);

// ensure it was created
if sw.is_none() { println!("bad window size") }

// add values on the fly
let values: [f64; 8] = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0];

for &v in values.iter() {
    let (mean, stddev) = sw.push(v);
    println!("add {}, window stats => mean: {}, standard deviation: {}", v, mean, stddev);
}

About

Online second-order statistics in sliding window

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages