meteorhacks/node-histo-utils

Name: node-histo-utils

Owner: meteorhacks

Description: A set of utilities to create, merge and manage histograms

Created: 2015-05-05 04:40:31.0

Updated: 2015-05-11 12:06:57.0

Pushed: 2015-05-11 12:07:15.0

Homepage: null

Size: 160

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

histo-utils

A set of utilities to create, merge and manage histograms.

Installaton
i --save histo-utils
Building a histogram
HistoUtil = require('histo-utils');
histoBuilder = HistoUtils.create();
oBuilder.addPoints([10, 20]);
oBuilder.addPoints([30, 40, 50]);

uild the histogram
histogram = histoBuilder.build();
ole.log(histogram);
utput => { bins: [ [ 10, 3 ], [ 40, 2 ] ], binSize: 24 }
Merging Histograms

Merging Histograms. This don't gives us perfect histogram compared with a one generated with rawData. But still, this works pretty well if you can't store raw data.

histogramOne = { 
bins: [ [ 10, 3 ], [ 40, 2 ] ], 
binSize: 24 

histogramTwo = { 
bins: [ [ 10, 4 ], [ 50, 2 ] ], 
binSize: 32 


merged = HistoUtils.merge([histogramOne, histogramTwo]);
ole.log(merged);
utput => { bins: [ [ 22, 7 ], [ 52, 4 ] ], binSize: 27 }
Calculating Percentiles

Currently, percentile is the starting point of the bin. But, we can improve this once we stored the skewness for each bin along with the frequency.

histogram = { 
bins: [ [ 10, 30 ], [20, 40], [ 40, 20 ], [80, 20], [99999, 1] ], 
binSize: 24 


percentiles = HistoUtils.getPercentiles(histogram, [50, 95, 99]);
ole.log(percentiles);
utput => { '50': 20, '95': 80, '99': 80 }

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.