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.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (30.7 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.1-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.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2fc756437d2a1bc801b5a6331f1ff70085f1960b6e16c090959b328b22cfc16f
MD5 361a597e693fadcf29b6be5813f3455e
BLAKE2b-256 018f794803532137a489af557da3563e6b7ca9bbdb843b46e3be7723031e8975

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