Skip to content

Fix b-bit MinHash estimator correction#325

Open
dipeshbabu wants to merge 1 commit into
ekzhu:masterfrom
dipeshbabu:agent/fix-b-bit-estimator
Open

Fix b-bit MinHash estimator correction#325
dipeshbabu wants to merge 1 commit into
ekzhu:masterfrom
dipeshbabu:agent/fix-b-bit-estimator

Conversation

@dipeshbabu

Copy link
Copy Markdown
Contributor

What

Correct the b-bit MinHash A(r, b) denominator to use the required 2^b exponent and add a focused regression test.

Why

The previous 2*b exponent produced a biased correction whenever b was greater than two and r was nonzero.

Impact

Jaccard estimates using a nonzero universe ratio now follow the published estimator. The r=0 behavior is unchanged.

Root cause

The exponentiation term was transcribed as multiplication.

Checks

  • uv run pytest -q test/test_minhash.py (18 passed)
  • uv run ruff check datasketch/b_bit_minhash.py test/test_minhash.py
  • git diff --check

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@3da96a5). Learn more about missing BASE report.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #325   +/-   ##
=========================================
  Coverage          ?   69.71%           
=========================================
  Files             ?       21           
  Lines             ?     2787           
  Branches          ?        0           
=========================================
  Hits              ?     1943           
  Misses            ?      844           
  Partials          ?        0           
Flag Coverage Δ
unittests 69.71% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dipeshbabu

Copy link
Copy Markdown
Contributor Author

@ekzhu could you review the PR?

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

Successfully merging this pull request may close these issues.

3 participants