Skip to main content

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

eb-optimization calibrates operational parameters (cost ratios, τ, readiness controls) and freezes them into auditable runtime policies. It does not compute metrics or run evaluation panels; those belong to eb-metrics and eb-evaluation.


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. © 2026 Kyle Corrie.

Metadata

Release files for eb-optimization 0.2.8

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-optimization 0.2.8
File Size Uploaded
eb_optimization-0.2.8.tar.gz 42.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for eb-optimization 0.2.8
File Interpreter ABI Platform
eb_optimization-0.2.8-py3-none-any.whl Python 3 none any Details

Total release size: 89.7 kB

Release files / eb_optimization-0.2.8.tar.gz

Download URL eb_optimization-0.2.8.tar.gz
Size 42.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f9b6f154bbec826a9e32c7c4c44ac0c4e76a1dcd42ec236b397ea363a01014a4
BLAKE2b-256 checksum
How to use checksums
8c312405e91e8a0ac6b3ef45880a82a8243099abe9165dec5075077caa1db683
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / eb_optimization-0.2.8-py3-none-any.whl

Download URL eb_optimization-0.2.8-py3-none-any.whl
Size 47.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a801080842d6aa292359eea98969e725a4ac3a7be8e9af9709bd12eb80ef7018
BLAKE2b-256 checksum
How to use checksums
e5268c88b43d9112796cafaa556085cf1ff6eb286482a8e97a75fb9b2177a7a2
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.8 This release

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

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