eval: fix the MAE confidence interval (hardcoded n=50) and return metrics as a dataframe - #367
Open
ipezygj wants to merge 1 commit into
Open
eval: fix the MAE confidence interval (hardcoded n=50) and return metrics as a dataframe#367ipezygj wants to merge 1 commit into
ipezygj wants to merge 1 commit into
Conversation
…a dataframe The per-horizon MAE was printed with a +-1.96*SEM band whose SEM divided by sqrt(50) regardless of how many rows the horizon group actually contained, so the reported interval was wrong whenever a group had more or fewer rows than 50 - which is essentially always (single-hour groups vs the [0, 36] aggregate). Replace it with a site-resampled percentile bootstrap: errors from the same PV site share weather and hardware, so sites are the independent unit - a plain row-level SEM would overstate the effective sample size. metrics() now also returns the per-horizon table (n, mae, 95% CI, normalized MAE) instead of only printing, so evaluations can be compared programmatically; prints remain. The previous test called metrics() on random data and asserted nothing; the new tests pin the MAE on a known constructed error, check the CI brackets it, narrows with more sites (the regression the hardcoded 50 hid), stays deterministic under the default seed, and that night rows are still filtered.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The per-horizon MAE in
eval/metrics.pyis printed with a±1.96·SEMband whose SEM divides by a hardcodedsqrt(50), regardless of how many rows the horizon group actually contains:Group sizes vary from a single horizon hour to the
[0, 36]aggregate, so the reported interval is wrong for essentially every group — too narrow for small groups, too wide for large ones.Change
metrics()now returns the per-horizon table (horizon_group, n, mae, mae_ci_low, mae_ci_high, mae_normalized) instead of only printing. Prints remain, so existing usage is unchanged; theTODO add more metrics using ocf_ml_metricscomment goes away (that repo no longer exists).metrics()on random data and asserted nothing. The new ones pin the MAE on a constructed known error, check the interval brackets the MAE, check it narrows with more sites (the regression the hardcoded 50 hid), check determinism under the default seed, and keep the night-filter behavior covered.Complementary to #361 — that asks for more point metrics (RMSE/MBE); this puts an honest uncertainty on the ones already reported. Happy to follow up with a persistence skill-score baseline (the truth is already fetched for every horizon 0–48h, so it's computable straight from
results_df) if there's interest.Verification note: the metric suite runs green locally (5/5); I have not run the full
run_evalpipeline (needs HF dataset access).