streaming-histogram-0.1.0.0

MaintainerTom Hunger
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Numeric.StreamingHistogram

Description

A very inefficient implementation of lossy online histograms based on the following paper:

NB This library is very experimental and inefficient. Numerical stability has not been tested (yet).

Synopsis

Documentation

empty Source

Arguments

:: Int

Maximum number of values to keep

-> Hist

The empty histogram

Creates an empty histogram to be updated with update

update Source

Arguments

:: Double

Value to add

-> Hist

Lossy histogram to update

-> Hist

Histogram with the value incorporated

Adds a single value to the histogram.

data Hist where Source

Constructors

Hist :: Int -> Map Double Int -> Hist 

Fields

nBins :: Int
 
histData :: Map Double Int
 

Instances

merge Source

Arguments

:: Hist

Histogram a

-> Hist

Histogram b

-> Maybe Hist

Returns Nothing if a and b disagree on how many values to keep.

Merges two histograms. Returns Nothing if they don't have the same number of values. TODO: Use more efficient algorithm.

sum Source

Arguments

:: Double

The cutoff value b

-> Hist

A histogram

-> Double

Estimated number of points

Estimates how many points lie in the interval [-infinity, b].