Skip to main content

Cost-Weighted Service Loss (CWSL): an asymmetric forecast error framework for operational forecasting.

Project description

CWSL

license status

Cost-Weighted Service Loss (CWSL) is a forecast evaluation framework designed for environments where under-forecasting and over-forecasting do not have the same operational cost.

Traditional metrics like MAE, RMSE, and MAPE treat being 5 units short the same as being 5 units long.
CWSL makes this asymmetry explicit and quantifies its impact at the operational interval level.


What is CWSL?

CWSL is a demand-normalized, directionally-aware forecast error metric that applies higher penalties for shortfalls and lower penalties for overbuilds, reflecting their true operational costs.

It is designed for high-frequency operational decision-making where the timing and direction of forecast error matter as much as magnitude.

CWSL incorporates:

  • Asymmetric penalties (cu for shortfall, co for overbuild)
  • Interval-level evaluation (5–30 minute windows)
  • Demand normalization for cross-store and cross-item comparability
  • Additivity, enabling aggregation across items, categories, or stores

Included Metrics

This library implements CWSL and its supporting diagnostics:

Core Metric

  • CWSL – Cost-Weighted Service Loss

Diagnostics

  • NSL – No-Shortfall Level
  • HR@τ – Hit Rate within Tolerance
  • UD – Underbuild Depth
  • wMAPE – Weighted Mean Absolute Percentage Error
  • FRS – Forecast Readiness Score (NSL - CWSL)

These metrics together provide a multidimensional view of operational readiness.


Why CWSL Matters

In real-world operations:

  • Shortfalls cause lost transactions, slower service, queue buildup, recovery delays, and negative customer experience.
  • Overbuilds typically cause minor waste or brief excess capacity.

Despite this, most organizations rely on symmetric error metrics that treat ± error as interchangeable.

CWSL exposes readiness-related failures that symmetric metrics consistently hide:

  • Shortfall clustering at peak periods
  • Asymmetric operational consequences
  • Deep misses that matter more than shallow overbuilds
  • Interval-level vulnerability that MAE/MAPE smooth over

If operational reliability matters, CWSL is the metric that aligns with reality.


Who Is CWSL For?

CWSL is applicable to any domain with short-horizon operational decisions, including:

  • Quick-service restaurants (QSR) & foodservice
  • Retail replenishment & on-shelf availability
  • Workforce & capacity planning
  • Manufacturing & production scheduling
  • Logistics & last-mile delivery
  • Energy & short-term load forecasting
  • Inventory & supply chain systems

If being “short” is worse than being “long,” CWSL applies.


Project Status

This project is under active development.

Planned for v0.1.0

  • Implement core metrics (CWSL, NSL, HR@τ, UD, wMAPE, FRS)
  • Add cwsl_from_df for item–interval DataFrame workflows
  • Publish on PyPI (pip install cwsl)
  • Add example notebooks (QSR, retail, workforce planning)
  • Add visualization tools for asymmetric penalties
  • Add CWSL-based model comparison utilities

Connect

If you'd like to discuss forecasting, operations, analytics, or the CWSL framework:

Created by Kyle Corrie (Economistician) Founder of the CWSL Metric and the Forecast Readiness Framework

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

cwsl-0.1.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

cwsl-0.1.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file cwsl-0.1.0.tar.gz.

File metadata

  • Download URL: cwsl-0.1.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for cwsl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d4d3428ad7455eced926b8f8b5900767c4801a9a455407291bb7307d2af2aec6
MD5 74a337ef7b917b3bd0ea76a05fea1bf1
BLAKE2b-256 02840154b793e1695420642d34249b318255d4b5509b9842646881fb25dd75b6

See more details on using hashes here.

File details

Details for the file cwsl-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cwsl-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for cwsl-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63118bdc825ee9ec0e6ecba6bb0fd41b9bd6e2786df66270f775783231522c10
MD5 fccc28183e8d71995a4cf4affee82146
BLAKE2b-256 b6abd50716cde0de910fdc3c080bef7ca32ca4f22e56660885056be86b20d111

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