Module Hub Beta

topk

Track the top-k most frequent elements in a stream‚Äč

Track the top-k most frequent elements in a stream using Redis.

The basic algorithm is described at (the 1st one): https://www.cs.berkeley.edu/~satishr/cs270/sp11/rough-notes/Streaming-two.pdf

When a TopK key reaches cardinality of k and a new element needs to be added, the following eviction policy it practiced:

  1. The frequencies of all existing observations are decreased by 1.
  2. If there is an observation that can be evicted, it is replaced by the element.
© 2017 Redis Labs, Inc. All rights reserved.