Turi Create
4.0
|
#include <ml/sketches/countsketch.hpp>
Public Member Functions | |
countsketch (size_t bits=16, size_t depth=5, size_t seed=1000) | |
Buckets. More... | |
void | add (const T &t, size_t count=1) |
counter_int | estimate (const T &t) |
void | combine (const countsketch &other) |
void | print () |
double | density () |
An implementation of the CountSketch for estimating the frequency of each item in a stream.
Usage is simple.
Definition at line 35 of file countsketch.hpp.
|
inlineexplicit |
Buckets.
Constructs a CountSketch having "width" 2^bits and "depth". The size of the matrix of counts will be depth x 2^bits.
bits | The number of bins will be 2^bits. |
depth | The "depth" of the sketch is the number of hash functions that will be used on each item. |
Definition at line 57 of file countsketch.hpp.
|
inline |
Adds an arbitrary object to be counted. Any object type can be used, and there are no restrictions as long as std::hash<T> can be used to obtain a hash value.
Note: Theoretical properties only apply to the situation where count is 1.
Definition at line 80 of file countsketch.hpp.
|
inline |
Merge two CountSketch datastructures. The two countsketch objects must have the same width and depth.
Definition at line 127 of file countsketch.hpp.
|
inline |
Computes the density of the internal counts matrix.
Definition at line 156 of file countsketch.hpp.
|
inline |
Returns the estimate of the frequency for a given object.
Definition at line 98 of file countsketch.hpp.
|
inline |
Prints the internal matrix containing the current counts.
Definition at line 143 of file countsketch.hpp.