예제 #1
0
 /// <summary>
 /// Restores the TopK to its original state. It returns itself to allow for
 /// chaining.
 /// </summary>
 /// <returns>The TopK</returns>
 public TopK Reset()
 {
     this.Cms.Reset();
     this.elements = new ElementHeap((int)K);
     this.N        = 0;
     return(this);
 }
예제 #2
0
 /// <summary>
 /// Creates a new TopK backed by a Count-Min sketch whose relative accuracy is
 /// within a factor of epsilon with probability delta. It tracks the k-most
 /// frequent elements.
 /// </summary>
 /// <param name="epsilon">Relative-accuracy factor</param>
 /// <param name="delta">Relative-accuracy probability</param>
 /// <param name="k">Number of top elements to track</param>
 /// <returns></returns>
 public TopK(double epsilon, double delta, uint k)
 {
     this.Cms      = new CountMinSketch(epsilon, delta);
     this.K        = k;
     this.elements = new ElementHeap((int)k);
 }