A fast and minimal minhashing based similarity checking library.
Project description
Minhashlib
This is a minimal implementation of MinHashing as described in Jeffrey Ullman's book Mining Massive Datasets.
Current Benchmark Claim
Based on the benchmark outputs in this repository:
- On recent multi-seed CPU synthetic runs (seeds
42-46),minhashlibbuilds signatures about~6xfaster thandatasketch. - Accuracy is comparable in magnitude (similar MAE scale and matching threshold-based metrics in these runs), though
datasketchis slightly better on MAE in most synthetic scenarios. - Memory results are workload-dependent, so this project does not claim universal memory superiority.
In short: this implementation is minimal and fast, with accuracy that is broadly comparable to datasketch, but outcomes vary depending on dataset and configuration.
Benchmark Suite
Use benchmarks/benchmark_claims_suite.py to run comprehensive, reproducible benchmarks:
- Multiple datasets (
synthetic,20newsgroups,wikipedia,ag_news,local) - Multiple seeds with mean/std/95% CI
- Metrics: MAE(Mean Average Error), Precision/Recall/F1 at threshold, Precision@K/Recall@K
- Speed: build/pair-eval/retrieval latency and throughput
- Memory: peak allocation and bytes/signature
- Optional scaling sweeps over docs/number of hashes/doc length
Example (full):
python3 benchmarks/benchmark_claims_suite.py
--datasets synthetic,20newsgroups,wikipedia
--wiki-dump-path data/simplewiki-latest-pages-articles.xml.bz2
--seeds 42,43,44
--p-values 2147483647,3037000493
--max-docs 2000
--random-pairs 3000
--num-queries 200
--include-scaling
Example (offline/local corpus only):
python3 benchmarks/benchmark_claims_suite.py
--datasets synthetic,local
--local-docs /path/to/docs.jsonl
--seeds 42,43,44
Outputs are written to benchmark_outputs/ by default:
raw_runs.json/raw_runs.csvsummary_stats.json/summary_stats.csvrun_metadata.jsonskipped_runs.json
Benchmark data setup
Pull required benchmark datasets into local project paths:
python3 scripts/setup_benchmark_data.py
This prepares:
data/simplewiki-latest-pages-articles.xml.bz2(for Wikipedia benchmarks).cache/scikit_learn_data(for20newsgroupsbenchmarks)
Optional flags:
python3 scripts/setup_benchmark_data.py --force
python3 scripts/setup_benchmark_data.py --skip-wikipedia
python3 scripts/setup_benchmark_data.py --skip-20newsgroups
Individual Benchmarks
You can run individual benchmarks instead of the full suite:
# Accuracy-only
python3 benchmarks/benchmark_claims_accuracy.py --datasets synthetic,20newsgroups,wikipedia
# Performance-only
python3 benchmarks/benchmark_claims_performance.py --datasets synthetic,20newsgroups,wikipedia
# Memory-only
python3 benchmarks/benchmark_claims_memory.py --datasets synthetic,20newsgroups,wikipedia
# Scaling-only (synthetic sweeps)
python3 benchmarks/benchmark_claims_scaling.py --datasets synthetic
Each individual benchmark writes outputs under benchmark_outputs/<test_name>/.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file minhashlib-0.1.0.tar.gz.
File metadata
- Download URL: minhashlib-0.1.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7b5e3ce95f0a1c896d81410f130217561aca6a9e0581e0171f16527a617c95f
|
|
| MD5 |
1d93dd259224c58ba98588c914eb16c5
|
|
| BLAKE2b-256 |
f6f8d3fd8f1ef0445788faafd10ac8bc27b54cf43c8ecfce73ab600174a1854c
|
File details
Details for the file minhashlib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: minhashlib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c0f03d7b74c856695fb1245a062d5ab2c90c5b28b7abe17e072a56ddfc08267
|
|
| MD5 |
186824a4b91d99c5aed2080151d24468
|
|
| BLAKE2b-256 |
9a1de12c868247ed7df87211d463869ceaf15b1d3c9a23ad43dbcdf63d244459
|