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.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (27.4 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.0-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.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2f8c6ada9a1e7d1c4b6dc6f3339b3b04e5875964b5bf21c25d2d4ee0c76a8ca0
MD5 25417792d6efccc8f1b49b0333c64f7e
BLAKE2b-256 ce7d4d7ccac861074a58c6f41b2d65bee4f4a7d39ec9de3673d175a029fb06a6

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