123456789101112131415161718192021222324252627282930313233343536# 1 "src/base/misc/owl_heavyhitters_sketch_sig.ml"(* A sketch to get the approximate heavy hitters from a dataset.
* A heavy-hitters sketch with threshold `k` will output all elements
* that have been added to it at least `n/k` times (where `n` is the
* total number of elements that have been added).
* Approximation behavior: with probability at least 1 - delta, the data
* structure outputs every element that appears at least `n/k` times, and
* every element output appears at least `n/k - (epsilon * n)` times.
* This implementation uses the Count-Min sketch implemented in
* `owl-countmin-sketch.ml`.
* Refer to http://dimacs.rutgers.edu/~graham/pubs/papers/cm-full.pdf
* section 5.2 (page 12) for more details. *)moduletypeSig=sig(** {5 Type definition} *)type'at(** The type of heavy-hitters sketches *)(** {5 Core functions} *)valinit:k:float->epsilon:float->delta:float->'at(**
`init k epsilon delta` initializes a sketch with threshold k, approximation
factor epsilon, and failure probability delta.
*)valadd:'at->'a->unit(** `add h x` adds value `x` to sketch `h` in-place. *)valget:'at->('a*int)list(**
`get h` returns a list of all heavy-hitters in sketch `h`, as a
(value, frequency) pair, sorted in decreasing order of frequency.
*)end