Add an element to the TopK
Element to add
Clear the content of the TopK
Load an Object from a provided JSON object
the JSON object to load
Return the Object loaded from the provided JSON object
Get the top-k values as an iterator that yields objects {value: string, frequency: number, rank: number}. WARNING: With this method, values are produced on-the-fly, hence you should not modify the TopK while the iteration is not completed, otherwise the generated values may not respect the TopK properties.
The top-k values as an iterator of object {value: string, frequency: number, rank: number}
Return a next random seeded int32 integer
Save the current structure as a JSON
Get the top-k values as an array of objects {value: string, frequency: number, rank: number}
The top-k values as an array of objects {value: string, frequency: number, rank: number}
Constructor
How many elements to store
The error rate
The probability of accuracy
Get a function used to draw random number
A factory function used to draw random integer
Get the seed used in this structure
Set the seed for this structure
the new seed that will be used in this structure
Generated using TypeDoc
A TopK computes the ranking of elements in a multiset (by an arbitrary score) and returns the
k
results with the highest scores. This implementation of the TopK problem sorts items based on their estimated cardinality in the multiset. It is based on a Count Min Sketch, for estimating the cardinality of items, and a MinHeap, for implementing a sliding window over thek
results with the highest scores.Thomas Minier
Arnaud Grall