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
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A set of utilities to create, merge and manage histograms.
i --save histo-utils
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. 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 }
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 }