Count Min Sketch:如何处理计数器溢出?
Count Min Sketch: How to handle counters overflow?
所以 Count-Min Sketch 的重点是根据提供的哈希函数的结果更新某些计数器。但是,这些计数器在内存中是有限的,在 运行 一段时间后,它们可能会溢出,从 MAX 值下降到 MIN 值(就像整数一样)。假设我只需要草图中的 N 个最频繁的值,除了每隔一段时间重新启动草图之外,是否有其他方法可以避免这种情况?
如果您担心,请使用适当大小的整数。
一个8字节(long long)无符号整数的最大值为18,446,744,073,709,551,615。这应该足够了。
编辑
Assuming all I need is the N most frequent values in the sketch, is there a way to avoid this other than restarting the sketch every once in a while?
也许您可以reservoir sampling适应您的需要。
所以 Count-Min Sketch 的重点是根据提供的哈希函数的结果更新某些计数器。但是,这些计数器在内存中是有限的,在 运行 一段时间后,它们可能会溢出,从 MAX 值下降到 MIN 值(就像整数一样)。假设我只需要草图中的 N 个最频繁的值,除了每隔一段时间重新启动草图之外,是否有其他方法可以避免这种情况?
如果您担心,请使用适当大小的整数。
一个8字节(long long)无符号整数的最大值为18,446,744,073,709,551,615。这应该足够了。
编辑
Assuming all I need is the N most frequent values in the sketch, is there a way to avoid this other than restarting the sketch every once in a while?
也许您可以reservoir sampling适应您的需要。