Skip to main content

Electric Barometer · Metrics (eb-metrics)

CI License: BSD-3-Clause Python Versions PyPI

Asymmetric, readiness-oriented forecast evaluation metrics for operational decision systems.


Overview

eb-metrics defines asymmetric, readiness-oriented forecast evaluation primitives (CWSL, NSL, UD, HR@τ, FRS, and related measures). It owns metric math only; evaluation orchestration, policies, and adapters live in sibling packages.


Installation

eb-metrics is distributed as a standard Python package.

pip install eb-metrics

The package supports Python 3.11 and later.


Core Concepts

  • Asymmetric error — Overforecasting and underforecasting can have different operational consequences, so evaluation should reflect directional cost differences.
  • Interval reliability — In readiness-oriented systems, it matters how often forecasts meet demand within each interval, not just average error over time.
  • Shortfall behavior — Underbuilding events are operationally distinct; evaluation should capture both their frequency and their severity.
  • Tolerance-based adequacy — Many systems can absorb small deviations; reliability can be expressed as the frequency of “accurate enough” intervals.
  • Readiness-oriented evaluation — Forecast quality is assessed by execution feasibility and risk, not solely statistical deviation.

Minimal Example

The following example computes Cost-Weighted Service Loss (CWSL) for a single demand series using asymmetric penalties for underbuild and overbuild:

import numpy as np
from eb_metrics import cwsl

# Realized demand and corresponding forecast
y_true = np.array([20, 28, 32, 35, 40, 42])
y_pred = np.array([22, 25, 29, 36, 37, 45])

# Compute cost-weighted service loss
loss = cwsl(
    y_true=y_true,
    y_pred=y_pred,
    cu=2.0,
    co=1.0,
)

print(loss)

License

BSD 3-Clause License. © 2026 Kyle Corrie.

Metadata

Release files for eb-metrics 0.2.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eb-metrics 0.2.9
File Size Uploaded
eb_metrics-0.2.9.tar.gz 17.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for eb-metrics 0.2.9
File Interpreter ABI Platform
eb_metrics-0.2.9-py3-none-any.whl Python 3 none any Details

Total release size: 38.9 kB

Release files / eb_metrics-0.2.9.tar.gz

Download URL eb_metrics-0.2.9.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
384971b857b8e2de852d0cbcee58e7bf417027302802107f913cf3bb90f2ff8c
BLAKE2b-256 checksum
How to use checksums
64829552b365ce7fe49c9c3e2a80fc2f427aab60ba45be7cf5c5c387297e128a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / eb_metrics-0.2.9-py3-none-any.whl

Download URL eb_metrics-0.2.9-py3-none-any.whl
Size 21.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ae000c1a40b3c892703aa269661650527b095bed3a51b31a018449f47363de7
BLAKE2b-256 checksum
How to use checksums
f97c7b019dd245a666c3bdbf2c51f376322fe296954c0647ec16814c67c81889
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.2.9 This release

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page