Page
Library
Module
Module type
Parameter
Class
Class type
Source
BinningSourceA datastructure (based on Hashtbl) to accumulate values in bins.
A value of type Binning.t can be seen as a generalized histogram: values are mapped to bins, and each bin keeps a summary value that is updated when an element is added (like a count, the list of elements, their mean, etc).
General type for binnings: values of type 'a are mapped to 'bins, holding a 'summary value updated using an 'increment
val create :
?n:int ->
bin:('a -> 'b) ->
zero:'d ->
add:('c -> 'd -> 'd) ->
unit ->
('a, 'b, 'c, 'd) tcreate ~n ~zero ~bin ~add creates a binning, which maps values to bins with bin, uses zero as a neutral element (that is the value associated to a bin before any value has been added to it) and updates the value of a bin with add. n is an estimation of the maximum number of bins.
add accu x y updates the value in accu for the bin of x by an increment y
find accu x returns the value associated to b in accu, returns the neutral element of the binning if the bin is empty.