[codex] Add calibrated forecast intervals - #21
Merged
Conversation
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 changed
non-overlapping rolling-origin errors
all observations after calibration
metadata with the model
Streamlit data loader
commands
Why
Point forecasts do not communicate how quickly uncertainty changes across a
recursive horizon. A single global residual standard deviation would also hide
the horizon effect and risk training leakage.
This implementation trains the calibration estimator only on data before the
held-out window. It then forecasts each calibration block recursively and uses
the finite-sample split-conformal order statistic independently at every lead.
The production estimator is refitted on all data only after widths have been
measured.
User impact
aep-forecastandaep-demonow produce:forecast_xgb_MWforecast_xgb_lower_MWforecast_xgb_upper_MWThe default target coverage is 90% over a trailing 30-day calibration window.
Coverage remains empirical: temporal dependence and distribution drift prevent
a formal distribution-free guarantee.
Validation
python -m ruff check src tests streamlit_app.pypython -m pytest -q— 87 passedpython -m compileall -q src tests streamlit_app.pypython -m buildthe model artifact