gds_psuu.kpi¶
KPI wrapper and legacy helper functions.
KPI wrapper and helper functions.
KPI
¶
Bases: BaseModel
Named KPI backed by either a legacy fn or a Metric + Aggregation pair.
Legacy usage (backwards compatible)::
KPI(name="avg_pop", fn=lambda r: final_state_mean(r, "population"))
Composable usage::
KPI(name="avg_pop", metric=final_value("population"), aggregation=mean_agg)
Source code in packages/gds-psuu/gds_psuu/kpi.py
compute(results)
¶
Compute the aggregated KPI score from results.
Source code in packages/gds-psuu/gds_psuu/kpi.py
per_run(results)
¶
Compute per-run metric values. Only available for metric-based KPIs.
Source code in packages/gds-psuu/gds_psuu/kpi.py
final_state_mean(results, key)
¶
Mean of a state variable's final-timestep values across all runs.
Filters to the last timestep (max substep) for each run and averages.
Source code in packages/gds-psuu/gds_psuu/kpi.py
final_state_std(results, key)
¶
Std dev of a state variable's final-timestep values across all runs.
Source code in packages/gds-psuu/gds_psuu/kpi.py
time_average(results, key)
¶
Mean of a state variable across all timesteps, substeps, and runs.