Statistical samplings that record the 'top N' data items. More...
#include <szaru.h>
Classes | |
struct | Elem |
Combination of a value & weight. More... | |
Public Member Functions | |
virtual void | AddElem (const std::string &elm)=0 |
Add a new element to this entry. | |
virtual void | AddWeightedElem (const std::string &elem, Value weight)=0 |
Add a new element with weight to this entry. | |
virtual void | Estimate (std::vector< Elem > &topElems)=0 |
Estimate the number of top entries. | |
virtual uint64_t | TotElems () const =0 |
Get the number of elements added to this entry in the table. | |
template<> | |
TopEstimator< int32_t > * | Create (uint32_t numTops) |
template<> | |
TopEstimator< int64_t > * | Create (uint32_t numTops) |
template<> | |
TopEstimator< double > * | Create (uint32_t numTops) |
Static Public Member Functions | |
static TopEstimator * | Create (uint32_t numTops) |
Create a TopEstimator object. |
Statistical samplings that record the 'top N' data items.
Note: Currently only 3 types (int32_t, int64_t, double) can be set to Value template.
Statistical samplings that record the 'top N' data items based on CountSketch algorithm from "Finding Frequent Items in Data Streams", Moses Charikar, Kevin Chen and Martin Farach-Colton, 2002.
virtual void SZaru::TopEstimator< Value >::AddElem | ( | const std::string & | elm | ) | [pure virtual] |
Add a new element to this entry.
elm | element to add |
virtual void SZaru::TopEstimator< Value >::AddWeightedElem | ( | const std::string & | elem, | |
Value | weight | |||
) | [pure virtual] |
Add a new element with weight to this entry.
elm | element to add | |
weight | weight of element |
static TopEstimator* SZaru::TopEstimator< Value >::Create | ( | uint32_t | numTops | ) | [static] |
Create a TopEstimator object.
numTops | number of top elements to be estimate. |
virtual void SZaru::TopEstimator< Value >::Estimate | ( | std::vector< Elem > & | topElems | ) | [pure virtual] |
Estimate the number of top entries.
topElems | estimated top entries |
virtual uint64_t SZaru::TopEstimator< Value >::TotElems | ( | ) | const [pure virtual] |
Get the number of elements added to this entry in the table.