Skip to main content

Electric Barometer: Optimization and tuning utilities for EB objectives and policy parameters.

Project description

Electric Barometer · Optimization (eb-optimization)

CI License: BSD-3-Clause Python Versions PyPI

Decision and policy layer for the Electric Barometer ecosystem, responsible for tuning, calibration, and governed parameter selection.


Overview

This repository contains the optimization, tuning, and policy governance layer of the Electric Barometer ecosystem. It defines how key evaluation parameters—such as cost ratios, tolerances, and readiness controls—are selected from data, validated under governance rules, and formalized into deterministic policies that can be reused across systems and environments.

Rather than computing metrics or running evaluations, this repository focuses on decision logic: how parameters are calibrated, how tradeoffs are resolved, and how those decisions are frozen into auditable artifacts. It provides the bridge between metric theory and operational deployment, ensuring that forecast evaluation behavior is consistent, explainable, and governed by explicit intent rather than ad-hoc configuration.


Role in the Electric Barometer Ecosystem

eb-optimization defines the parameter selection, calibration, and governance logic used throughout the Electric Barometer ecosystem. It is responsible for determining how key operational parameters—such as cost ratios, tolerance bands, and readiness controls—are selected from data in a disciplined, reproducible, and decision-aware manner.

This repository focuses exclusively on optimization mechanics and policy formation. It does not define metric primitives, perform evaluation orchestration, manage model interfaces, or execute runtime decision logic. Those responsibilities are handled by adjacent layers in the ecosystem that compute metrics, evaluate forecasts, or apply frozen policies in production workflows.

By separating parameter selection and governance from metric semantics and execution concerns, eb-optimization provides a stable optimization layer that enables consistent calibration, transparent decision rules, and auditable policy artifacts across heterogeneous forecasting and operational contexts.


Installation

eb-optimization is distributed as a standard Python package.

pip install eb-optimization

Core Concepts

  • Parameter governance — Operational parameters (e.g., cost ratios, tolerances) should be selected through explicit, reproducible rules rather than ad-hoc tuning or implicit defaults.
  • Search over candidate spaces — Optimization is framed as deterministic search over bounded, interpretable candidate sets, enabling transparent tradeoffs and stable outcomes.
  • Cost balance calibration — Asymmetric operational costs can be balanced by selecting parameters that equalize or appropriately trade off opposing risk exposures.
  • Tolerance selection from residuals — Acceptable error bands can be learned directly from historical performance, reflecting empirical system behavior rather than arbitrary thresholds.
  • Policy separation — Calibration logic is separated from frozen policy artifacts so that parameter selection is auditable, versioned, and safely applied in downstream systems.
  • Decision-aligned optimization — Optimization is evaluated by operational interpretability and governance fitness, not by abstract numerical optimality alone.

Minimal Example

The example below illustrates a typical optimization workflow using eb-optimization: calibrating an operational parameter from historical data and applying it via a frozen policy.

import numpy as np
from eb_optimization.policies import (
    CostRatioPolicy,
    apply_cost_ratio_policy,
)

# Historical actuals and forecasts
y_true = np.array([10, 12, 15, 20])
y_pred = np.array([9, 14, 18, 17])

# Define a frozen cost-ratio policy
policy = CostRatioPolicy(
    R_grid=(0.5, 1.0, 2.0, 3.0),
    co=1.0,
)

# Estimate a global cost ratio R
R, diagnostics = apply_cost_ratio_policy(
    y_true=y_true,
    y_pred=y_pred,
    policy=policy,
)

print(R)

License

BSD 3-Clause License.
© 2025 Kyle Corrie.

Project details


Download files

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

Source Distribution

eb_optimization-0.2.0.tar.gz (27.5 kB view details)

Uploaded Source

Built Distribution

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

eb_optimization-0.2.0-py3-none-any.whl (31.7 kB view details)

Uploaded Python 3

File details

Details for the file eb_optimization-0.2.0.tar.gz.

File metadata

  • Download URL: eb_optimization-0.2.0.tar.gz
  • Upload date:
  • Size: 27.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for eb_optimization-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8c9fcf696be2f7f09dcd1f961ca5f6a9bd69c394b6f0afe270c36d18e38b721b
MD5 ce9387ebfa347ff1e38ee64d0f684691
BLAKE2b-256 054b34c63d4654048c3596dc38edb58e6d2eef3b62e4d0a44e11c3cafd79b455

See more details on using hashes here.

Provenance

The following attestation bundles were made for eb_optimization-0.2.0.tar.gz:

Publisher: release.yml on Economistician/eb-optimization

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file eb_optimization-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for eb_optimization-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9dfbbd9c596dbb516f985c985b965ae1f5ba0765dadd92ef72bdfa6a5a87cef
MD5 e881e4a902a7bc5259af93fa97e9b1c7
BLAKE2b-256 4701b3f1e9ec7e6cceb08da586718b18f5bac755d4085bb7de6f751419ab6e21

See more details on using hashes here.

Provenance

The following attestation bundles were made for eb_optimization-0.2.0-py3-none-any.whl:

Publisher: release.yml on Economistician/eb-optimization

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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