Skip to main content

Ok Bloomer

An implementation of the OkBloomer algorithm, an autoscaling Bloom filter with ultra-low memory footprint for Python. Ok Bloomer employs a novel layered filtering strategy that allows it to expand while maintaining an upper bound on the false positive rate. As such, Ok Bloomer is suitable for streaming data where the size is not known a priori.

  • Ultra-low memory footprint
  • Autoscaling works on streaming data
  • Bounded maximum false positive rate
  • Open-source and free to use commercially

Installation

Install DNA Hash using a Python package manager, example pip:

pip install okbloomer

Parameters

# Name Default Type Description
1 max_false_positive_rate 0.01 float The upper bound on the false positivity rate.
2 num_hashes 4 int The number of hash functions used, i.e. the number of slices per layer.
3 layer_size 32000000 int The size of each layer of the filter in bits. Ideal sizes can be divided evenly by num_hashes.

Example Usage

from okbloomer import BloomFilter

filter = BloomFilter(
    max_false_positive_rate=0.01,
    num_hashes=4,
    layer_size=32000000,
)

filter.insert('foo')

print(filter.exists('foo'))

print(filter.existsOrInsert('bar'))

print(filter.exists('bar'))

print(filter.false_positive_rate())
True 

False

True

3.906249999999999e-27

References

  • [1] A. DalPino. (2021). OkBloomer, a novel autoscaling Bloom Filter [link].
  • [2] K. Christensen, et al. A New Analysis of the False-Positive Rate of a Bloom Filter.
  • [3] A. Kirsch, et al. Less Hashing, Same Performance: Building a Better Bloom Filter, 2006.

Metadata

Release files for OkBloomer 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for OkBloomer 0.0.4
File Size Uploaded
okbloomer-0.0.4.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for OkBloomer 0.0.4
File Interpreter ABI Platform
okbloomer-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / okbloomer-0.0.4.tar.gz

Download URL okbloomer-0.0.4.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
74983b51b919113b2df0cc842bd453deff9e39f292fa5bf60a18188585be82b0
BLAKE2b-256 checksum
How to use checksums
32d9373d66a8c03dea1efabf4c982a2f4337051012e63a78d8231a6d7ace4033
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release files / okbloomer-0.0.4-py3-none-any.whl

Download URL okbloomer-0.0.4-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7d5bce101877d834477d3412ec953359a1ba03f5fccb0b095136a35c46e12aa
BLAKE2b-256 checksum
How to use checksums
8880fd076e3a606d97525e53747cf415b2332842552caec8ab4601e2ba55a256
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page