#include <topk.h>
Public Types | |
typedef TopkEntry< KEY > | Element |
typedef std::vector< TopkEntry< KEY > > | Base |
Public Member Functions | |
void | reset (unsigned k, float r=std::numeric_limits< float >::max()) |
Reset the heap. | |
void | reset (unsigned k, KEY key, float r=std::numeric_limits< float >::max()) |
void | reset (float r) |
float | threshold () const |
Topk & | operator<< (Element t) |
Insert a new element, update the heap. | |
float | recall (const Topk< KEY > &topk) const |
Calculate recall. | |
unsigned | getK () const |
Following is an example of using the Topk class:
Topk<Key> topk; topk.reset(k);
for each candidate key { topk << key; }
At this point topk should contain the best k keys.
float lshkit::Topk< KEY >::recall | ( | const Topk< KEY > & | topk | ) | const [inline] |
Calculate recall.
Recall = size(this /\ topk) / size(this).