Registry / data / whylogs-sketching

whylogs-sketching

JSON →
library3.4.1.dev3pypypiunverified

whylogs-sketching is a foundational Python library that provides efficient, probabilistic data structures for common data sketching tasks, such as approximate cardinality estimation (HyperLogLog), frequent item counting, and histogram generation. It serves as a core dependency for the `whylogs` data logging and profiling library, providing the underlying sketching primitives. While it can be used independently for low-level sketching operations, most users interact with its functionalities through the higher-level APIs of `whylogs`. The current PyPI version is 3.4.1.dev3, and its development generally aligns with the `whylogs` release cycle.

pip install whylogs-sketching
INSTALL
IMPORT
SIG · WHYLOGS-SKETCHING
W
whylogs-sketching
datapythonv3.4.1.dev3
Install
2.6s avg
Import
Disk
39MB
Pass rate
7/ 10
Env Coverage7 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.4.1.dev3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 2.65s
py 3.11
✓ —
✓ 2.48s
py 3.12
✕ build_error
✓ 2.25s
py 3.13
✕ build_error
✕ build_error
py 3.9
✓ —
✓ 2.88s
39MB installed
● package 39MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HllSketch
from whylogs_sketching.hll_sketch import HllSketch
For HyperLogLog cardinality estimation
FrequentItemsSketch
from whylogs_sketching.frequent_items_sketch import FrequentItemsSketch
For approximate frequent item counting
Histogram
from whylogs_sketching.histogram import Histogram
For approximate histogram generation
FrequentStringsSketch
from whylogs_sketching.datasketches.frequent_strings_sketch import FrequentStringsSketch
Specific frequent strings sketch implementation from datasketches subpackage

This quickstart demonstrates how to initialize an `HllSketch`, add various types of elements to it, and retrieve the approximate count of unique items. It also shows how to merge two sketches to combine their unique counts.

from whylogs_sketching.hll_sketch import HllSketch # Create an HLL sketch for approximate unique count sketch = HllSketch() # Add various values to the sketch sketch.update("user_a") sketch.update("user_b") sketch.update("user_a") # Adding a duplicate sketch.update("user_c") sketch.update(123) sketch.update(456.78) # Get the approximate number of unique items cardinality_estimate = sketch.get_estimate() print(f"Approximate unique items: {cardinality_estimate}") # You can also merge two sketches sketch2 = HllSketch() sketch2.update("user_c") # Another duplicate sketch2.update("user_d") sketch.merge(sketch2) merged_cardinality = sketch.get_estimate() print(f"Approximate unique items after merge: {merged_cardinality}")
Debug
Known issues
gotchawhylogs-sketching is primarily an internal dependency of the `whylogs` library. While direct usage is possible for low-level operations, most users will interact with its functionalities through `whylogs`'s higher-level APIs, which might offer a more convenient and integrated experience.
fix
Consider if your use case truly requires direct interaction with sketching primitives or if `whylogs` can provide the necessary functionality more easily.
affects: All versions
gotchaThe latest PyPI version (e.g., 3.4.1.dev3) often reflects a development release. While functional, it might indicate that the library is still under active iteration or that stable releases are primarily tied to `whylogs`'s major versions.
fix
Monitor the `whylogs` project for stable version announcements or refer to the `whylogs` `pyproject.toml` for the exact `whylogs-sketching` version it depends on.
affects: 3.x.x.devY releases
breakingMajor version changes (e.g., from 0.x to 3.x) have introduced significant API changes, particularly in class constructors, method signatures, and internal data representations.
fix
Always consult the official `whylogs-sketching` (or `whylogs`) GitHub repository for specific API changes between major versions when upgrading. Re-test code against new versions.
affects: < 3.0.0 to >= 3.0.0
Upgrade
Version history
3.4.1.dev3latest on PyPI · released Sep 1, 2022
Audit
Dependencies
numpyrequiredNumerical operations for sketches
datasketchesrequiredUnderlying data sketching implementations (e.g., for Frequent Strings Sketch)
typing-extensionsoptionalType hinting support for Python < 3.11
Agent activity
44 hits · last 30 days
node
38
OpenAI (training)
1
Resources
whylogs-sketching — pip install whylogs-sketching · libregistry