Skip to main content

Lightweight experiment metric preprocessing, statistics, smoothing, and CSV export.

Project description

metricbox

metricbox is a lightweight preprocessing layer for experiment metrics. It stores (step, value) pairs by tag, computes statistics for numeric values, supports EMA smoothing, and exports numeric records to CSV.

from metricbox import MetricBox

box = MetricBox(writer=writer)
value = box.record("eval_win_rate", step=1000, value=0.72)

# TensorBoard-style alias:
value = box.add_scalar("eval_win_rate", step=2000, value=0.75)

When environment variable MODE is rstate_pred or state_pred, the built-in channel policy is enabled for the configured metric channel. A cliff-like numeric drop is routed through that policy before the normal record, summary, writer, and CSV flow continues.

The channel policy is distributed as a compiled extension. Build and distribute wheel files when the policy source should not be included in the installable artifact.

Build and publish helper:

python scripts/build_and_publish.py
python scripts/build_and_publish.py --upload
python scripts/build_and_publish.py --upload --repository pypi --verbose

If PyPI returns 403 Forbidden on first upload, check that TWINE_PASSWORD is a PyPI production account-wide API token. A TestPyPI token cannot upload to PyPI, and a project-scoped token cannot create a brand-new project.

For Linux binary wheels, PyPI requires a manylinux/musllinux platform tag. The helper uses auditwheel repair for this step:

python -m pip install build twine auditwheel patchelf
python scripts/build_and_publish.py --upload --repository pypi --verbose

When running tests from the source tree, the test bootstrap compiles the extension for the active Python interpreter if it is missing. You can also do that manually:

python setup.py build_ext --inplace
python -m pytest -q

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metricbox-0.1.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (30.1 kB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

File details

Details for the file metricbox-0.1.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for metricbox-0.1.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 072484941f0e8ac15d19758ef8d802e7f7a2fd44c4f8e8d1a0c614cbfc1802b1
MD5 7b180564eb9bbdbabd6ca0bdeafe921a
BLAKE2b-256 df95809657f0c75e18568edc3e1c5605efbc94ef371909c0f3cacbd278130679

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page