Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrest hash counting of CountMinSketch #48

Open
awen-li opened this issue Sep 16, 2021 · 0 comments
Open

Incorrest hash counting of CountMinSketch #48

awen-li opened this issue Sep 16, 2021 · 0 comments

Comments

@awen-li
Copy link

awen-li commented Sep 16, 2021

Description

During using the lib CountMinSketch, the counting is unexpected when the item number is larger than the table size.

Steps/Code/Corpus to Reproduce

'''
from bounter import CountMinSketch

Cms = None
LogCounting = None

def setUp(LogCounting = None):
return CountMinSketch(1, width=2, depth=2, log_counting=LogCounting)

Cms = setUp ()

Loop = 8
ItemNum=8

print ("Loop = ", Loop)
for i in range (0, Loop):
for s in range (0, ItemNum):
Cms.increment(str (s))

for s in range (0, 8):
print ("Cms[%d] = %d" %(s, Cms[str (s)]))

'''

Expected Results

Cms[0] = 8
Cms[1] = 8
Cms[2] = 0
Cms[3] = 0
Cms[4] = 0
Cms[5] = 0
Cms[6] = 0
Cms[7] = 0

Actual Results

Cms[0] = 22
Cms[1] = 22
Cms[2] = 22
Cms[3] = 24
Cms[4] = 24
Cms[5] = 23
Cms[6] = 23
Cms[7] = 24

Versions

the main branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant