Panel evaluation¶
This section documents evaluation utilities for panel-style data.
Panel evaluation supports analysis of entity-by-time datasets commonly produced by forecasting and readiness pipelines.
eb_evaluation.dataframe.panel
¶
Panel-style evaluation output (DataFrame utilities).
This module provides a convenience wrapper that evaluates a DataFrame at multiple hierarchy levels and returns a long-form (tidy) panel suitable for reporting, plotting, and downstream aggregation.
The implementation delegates the core computation to
eb_evaluation.dataframe.hierarchy.evaluate_hierarchy_df and then reshapes the wide
per-level outputs into a single stacked table with:
- a
levelcolumn (which hierarchy level produced the row) - optional grouping key columns (depending on the level)
metric/valuecolumns for tidy analysis
evaluate_panel_df(df, levels, actual_col, forecast_col, cu, co, tau=None)
¶
Evaluate metrics at multiple levels and return a long-form panel DataFrame.
This is a convenience wrapper around
eb_evaluation.dataframe.hierarchy.evaluate_hierarchy_df that:
- Computes a wide metrics DataFrame per hierarchy level.
- Stacks them into a single table with a
levelcolumn. - Melts metrics into
metric/valuepairs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Input DataFrame containing at least |
required |
levels
|
dict[str, Sequence[str]]
|
Mapping of level name to the column names used to group at that level. Example:
|
required |
actual_col
|
str
|
Column name for actual demand / realized values. |
required |
forecast_col
|
str
|
Column name for forecast values. |
required |
cu
|
Underbuild (shortfall) cost coefficient passed through to CWSL/FRS evaluations. |
required | |
co
|
Overbuild (excess) cost coefficient passed through to CWSL/FRS evaluations. |
required | |
tau
|
float | None
|
Tolerance parameter for HR@tau. If |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Long-form (tidy) panel with columns:
Each row corresponds to a single metric evaluated at a specific level/group. |
Notes
- The set of metric columns is derived from the outputs of
eb_evaluation.dataframe.hierarchy.evaluate_hierarchy_df. Only metrics present in the combined wide table are melted. - Grouping key columns vary by level. The returned panel includes the union of all grouping key columns across levels; levels that do not use a given key will have NaN in that column.