Turi Create
4.0
|
#include <ml/sketches/space_saving.hpp>
Public Member Functions | |
space_saving (double epsilon=0.0001) | |
void | initialize (double epsilon=0.0001) |
void | clear () |
void | add (const T &t, size_t count=1) |
size_t | size () const |
std::vector< std::pair< T, size_t > > | frequent_items () const |
std::vector< std::pair< T, size_t > > | guaranteed_frequent_items () const |
template<typename U > | |
std::enable_if< std::is_convertible< U, T >::value, void >::type | combine (const space_saving< U > &other) |
This class implements the Space Saving Sketch as described in Ahmed Metwally † Divyakant Agrawal Amr El Abbadi. Efficient Computation of Frequent and Top-k Elements in Data Streams.
It provides an efficient one pass scan of all the data and provides an estimate all the frequently occuring elements, with guarantees that all elements with occurances >= N will be reported.
Definition at line 42 of file space_saving.hpp.
|
inline |
Constructs a save saving sketch using 1 / epsilon buckets. The resultant hyperloglog datastructure will 1 / epsilon memory, and guarantees that all elements with occurances >= N will be reported.
Definition at line 49 of file space_saving.hpp.
|
inline |
Adds an item with a specified count to the sketch.
Definition at line 85 of file space_saving.hpp.
|
inline |
Clears everything out.
Definition at line 72 of file space_saving.hpp.
|
inline |
Merges a second space saving sketch into the current sketch
Definition at line 160 of file space_saving.hpp.
|
inline |
Returns all the elements tracked by the sketch as well as an estimated count. The estimated can be a large overestimate.
Definition at line 100 of file space_saving.hpp.
|
inline |
Returns all the elements tracked by the sketch as well as an estimated count. All elements returned are guaranteed to have occurance >= epsilon * m_size
Definition at line 131 of file space_saving.hpp.
|
inline |
Initalizes a save saving sketch using 1 / epsilon buckets. The resultant hyperloglog datastructure will use O(1 / epsilon) memory, and guarantees that all elements with occurances >= N will be reported.
Definition at line 61 of file space_saving.hpp.
|
inline |
Returns the number of elements inserted into the sketch.
Definition at line 92 of file space_saving.hpp.