Efficient batch statistics computation library for Python.
Project description
BatchStats
BatchStats computes statistics on data that arrives in batches, so you can stream or process large datasets without loading everything into memory. Feed batches with update_batch, then call the object to get the final result.
Installation
pip install batchstats
Or with conda/mamba:
conda install -c conda-forge batchstats
Quick Start
import numpy as np
from batchstats import BatchMean, BatchVar
data_stream = (np.random.randn(100, 10) for _ in range(10))
batch_mean = BatchMean()
batch_var = BatchVar()
for batch in data_stream:
batch_mean.update_batch(batch)
batch_var.update_batch(batch)
mean = batch_mean()
variance = batch_var()
print(f"Mean shape: {mean.shape}")
print(f"Variance shape: {variance.shape}")
Available Statistics
BatchSum/BatchNanSumBatchWeightedSumBatchMean/BatchNanMeanBatchWeightedMeanBatchMin/BatchNanMinBatchMax/BatchNanMaxBatchPeakToPeak/BatchNanPeakToPeakBatchVarBatchStdBatchCovBatchCorr
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
batchstats-0.6.tar.gz
(18.7 kB
view details)
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
batchstats-0.6-py3-none-any.whl
(31.0 kB
view details)
File details
Details for the file batchstats-0.6.tar.gz.
File metadata
- Download URL: batchstats-0.6.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62177570b198fc0db3d2f1c31d1fcf787b60f9f49f128ef1c46ed3e251e826cc
|
|
| MD5 |
cf15cf0593c6451e8ff7fab80d538798
|
|
| BLAKE2b-256 |
08a6f2f0afe9b8b92a0870adb307b5af73074b1221931fe0f995215c9b7f29fc
|
File details
Details for the file batchstats-0.6-py3-none-any.whl.
File metadata
- Download URL: batchstats-0.6-py3-none-any.whl
- Upload date:
- Size: 31.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ac7cebc5545a69d36e48876d5ff7a9e7f42f6e72dd392fb97c3f0462f922553
|
|
| MD5 |
0ca3c1e1003a7e2dbf1f40793db15e32
|
|
| BLAKE2b-256 |
ac3c8c31f0cdf631e87283470201f4cea58404ca10822da3366b5cbdc24ef491
|