Library
Module
Module type
Parameter
Class
Class type
A 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 'bin
s, 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) t
create ~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.
val add : ('a, _, 'c, _) t -> 'a -> 'c -> unit
add accu x y
updates the value in accu
for the bin of x
by an increment y
val find : (_, 'a, _, 'b) t -> 'a -> 'b
find accu x
returns the value associated to b
in accu
, returns the neutral element of the binning if the bin is empty.
module Counter : sig ... end
module Relation : sig ... end