Heare Histograms Library
This library provides two main classes: Histogram and Group. The Histogram class is a generic data structure for storing and sampling data points, while the Group class represents a collection of Histogram instances or other Group instances. Groups can be used to generate synthetic composite histograms.
Installation
To install the library, you can use pip:
pip install heare-histograms
Usage
Histogram
The Histogram class can be imported and used as follows:
from heare.histograms import Histogram, Shift, Scale, Max
# Create a new histogram
hist = Histogram[int](max_size=1000)
# Observe data points
hist.observe([1, 2, 3, 4, 5])
# Sample a data point
sample = hist.sample()
# Get the value at a given percentile
percentile_val = hist.percentile(0.9)
# Combine two histograms
hist2 = Histogram[int](data=[10, 20, 30])
combined = hist + hist2
# Apply transformations to the histogram
shifted_hist = Shift(hist, 10)
scaled_hist = Scale(hist, 2.0)
capped_hist = Max(hist, 100)
The Histogram class supports various operations, such as observing new data points, sampling, computing percentiles, combining histograms, and applying transformations like shifting, scaling, and capping values.
Group
The Group class can be imported and used as follows:
from heare.histograms import Histogram, Group
# Create a new group with two histograms
hist1 = Histogram[int](data=[1, 2, 3])
hist2 = Histogram[int](data=[10, 20, 30])
group = Group[int]([("hist1", hist1), ("hist2", hist2)])
# Sample a value from the group
sample = group.sample()
# Explain the sampled value
explanation = group.explain_sample()
The Group class allows you to combine multiple Histogram instances or other Group instances into a single entity. You can sample values from the group and obtain an explanation of the sampled value, breaking it down into contributions from each element.
Contributing
Contributions to the library are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.
License
This library is released under the MIT License.
Metadata
Release files for heare-histograms 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| heare_histograms-0.1.3.tar.gz | 5.3 kB | Without provenance | Details for heare_histograms-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| heare_histograms-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for heare_histograms-0.1.3-py3-none-any.whl |
Total release size: 11.4 kB
Release files / heare_histograms-0.1.3.tar.gz
| Download URL | heare_histograms-0.1.3.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
012af29c90004dbb9f16d82aa489d841ad1f775ebda7bdd610cd8f33fc4ca5ff
|
|
BLAKE2b-256 checksum How to use checksums |
5efdb4c48a70dcb6ece91e6e32aaa4649fb6385134a2c35624ab82636b3a6f2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / heare_histograms-0.1.3-py3-none-any.whl
| Download URL | heare_histograms-0.1.3-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bc5d1f888401d0387728975c6755664cc4e4924e30a57278b6fcd7b8f59a087e
|
|
BLAKE2b-256 checksum How to use checksums |
69852b9c524cfea1e0f45a835c11d62042c89a133bbb8363f4ea6b23d8eb783c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Security for heare-histograms 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.