package biocaml
Install
Dune Dependency
Authors
Maintainers
Sources
md5=497e3f2f7128a6ca347d66848da38a3d
sha512=4a76ebbafda3bc944afaff40d69791dfe153a0638ef5d7e6e1bc962b7f991d9545cd0af2d7930b39f8b31dbf067d0603cfa03d9b7a49396ab1ae452df47fd1f3
doc/biocaml.unix/Biocaml_unix/Accu/index.html
Module Biocaml_unix.Accu
A datastructure (based on Hashtbl) to accumulate values.
An Accu.t
can be seen as a generalized histogram: samples are mapped to bins, and each bin has a corresponding value which may be its size or its contents depending on the need.
Generic API
General type for accumulators: 'sample
s are mapped to 'bin
s, and the 'accu
mulated value for a 'bin
is updated with 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 an accumulator, which maps instances 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, 'b, 'c, 'd) t -> 'a -> 'c -> unit
add accu x y
updates the value in accu
for the bin of x
by an increment y
val stream : ('a, 'b, 'c, 'd) t -> ('b * 'd) Stream.t
val to_alist : ('a, 'b, 'c, 'd) t -> ('b * 'd) list
val get : ('a, 'b, 'c, 'd) t -> 'b -> 'd option
get accu x
returns the value associated to b
in accu
.
Counters and histograms
module Counter : sig ... end
val product :
?filter:('a -> 'b -> bool) ->
('a -> 'b -> 'c) ->
'a list ->
'b list ->
('c * int) Stream.t
product filter f l1 l2
computes an histogram of values returned by f when it is applied for all combinations of elements in l1
and l2
such that the predicate filter
is true
Relation
module Relation : sig ... end
module Bins : sig ... end