Single-series evaluation¶
This section documents evaluation utilities for single time series.
Single-series evaluation supports focused analysis of forecast accuracy and diagnostics for an individual series without cross-entity aggregation.
eb_evaluation.dataframe.single
¶
Single-slice CWSL evaluation (DataFrame utilities).
This module provides a lightweight DataFrame wrapper around eb_metrics.metrics.cwsl for
computing Cost-Weighted Service Loss (CWSL) on a single slice of data (i.e., the entire
DataFrame provided).
It supports both scalar costs and per-row cost columns for asymmetric cost evaluation.
compute_cwsl_df(df, y_true_col, y_pred_col, cu, co, sample_weight_col=None)
¶
Compute CWSL from a DataFrame.
This is a convenience wrapper around eb_metrics.metrics.cwsl that accepts a pandas
DataFrame and column names.
Costs can be specified either as scalars or as per-row columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Input table containing at least the actual and forecast columns, and optionally cost/weight columns. |
required |
y_true_col
|
str
|
Name of the column containing actual demand values. |
required |
y_pred_col
|
str
|
Name of the column containing forecast values. |
required |
cu
|
float | str
|
Underbuild (shortfall) cost coefficient.
|
required |
co
|
float | str
|
Overbuild (excess) cost coefficient.
|
required |
sample_weight_col
|
str | None
|
Optional column name containing non-negative sample weights per row. If |
None
|
Returns:
| Type | Description |
|---|---|
float
|
The Cost-Weighted Service Loss (CWSL) value for the provided DataFrame slice. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If any required columns are missing. |
ValueError
|
If the underlying |
Notes
This function performs minimal validation and delegates metric validation to
eb_metrics.metrics.cwsl.