Madoka is a Python library that provides a memory-efficient implementation of the CountMin Sketch probabilistic data structure, based on the Madoka C++ library. It's designed for estimating frequencies of items in a data stream with limited memory. The current version is 0.7.2.1, and releases occur infrequently, primarily for maintenance or updates to the underlying C++ library.
pip install madokaVerified import paths — ran on the pinned version, not inferred.
Initializes a CountMin Sketch, adds byte-encoded items, queries their approximate frequencies, and demonstrates resetting the sketch.
Ensure all keys passed to `add()` or `query()` are byte strings. For example, use `b'your_key'` or `key.encode('utf-8')`.Install build tools (e.g., `build-essential` on Debian/Ubuntu, Xcode Command Line Tools on macOS, Visual C++ Build Tools on Windows) before running `pip install madoka`.
Carefully choose `width` (or `epsilon`) based on your memory constraints and desired accuracy. Monitor memory usage in production environments.
No dependency data recorded yet.