Release train: PACF lag selection, boundary helpers, diagnostics plots#216
Merged
Conversation
## [8.0.0-rc.2](v8.0.0-rc.1...v8.0.0-rc.2) (2026-06-11) ### Features * **deps:** require spotforecast2-safe >=22.0.0 ([13893ad](13893ad))
…, SHAP summary, forecast-vs-reference) Ports five matplotlib helpers from bart26k-lecture/scripts/team4_4zones_submit.py into a reusable, stateless public API in spotforecast2.plots.diagnostics: - feature_family(name) — maps LGBMRegressor feature names to six diagnostic families - plot_acf_with_lags(acf, key_lags, conf) — bar chart with confidence band and annotated key lags - plot_feature_importance_by_family(names, importances, top_n) — top-N barh coloured by family - plot_shap_summary(estimator, X, max_samples) — subsampled TreeExplainer bar summary - plot_forecast_vs_reference(forecast, reference, ...) — generalised forecast-vs-ENTSO-E line plot All functions return matplotlib.figure.Figure; the caller saves/closes. No plt.show(), no matplotlib.use(), no global state mutation. Overlap MAD is logged at INFO via the module logger (preserved from the original). 44 new tests in tests/test_plots_diagnostics.py; 1207 tests pass total. Registered in _quarto.yml sidebar + quartodoc contents (plots.diagnostics). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- stats/autocorrelation.py: add select_pacf_lags(), ported from bart26k-lecture/scripts/team4_4zones_submit.py (select_key_lags). Computes PACF up to n_lags, returns top_k significant lags sorted ascending; falls back to caller-supplied list or raises ValueError on degenerate series. - model_selection/boundary.py (new): three search-space boundary helpers promoted from bart26k-lecture/14_team_4_submission.qmd and team4_4zones_submit.py (KB entry 2026-06-08-hyperparameter-boundary- management). report_boundary_positions() logs and returns flagged dims; boundary_report() returns a DataFrame; suggest_bounds() returns a widened search space ready for a round-2 run_task_spotoptim() call. - tests/test_stats_select_pacf_lags.py: 15 tests (AR(1), AR(24), degenerate/constant, fallback, determinism, top_k bounds). - tests/test_model_selection_boundary.py: 27 tests (linear/log10 dims, prefix stripping, bool skip, categorical skip, missing key, logger injection, suggest_bounds widening for float/log/int). - _quarto.yml: register stats.select_pacf_lags and model_selection.boundary in sidebar and quartodoc sections. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
FIX 1 (blocker): plot_forecast_vs_reference MAD log now uses
`mad * unit_scale` (not `mad / unit_scale`) so the value is
reported in the display unit (GW) rather than inflated by 1000×.
Log format updated to include the unit label. Strengthened test
asserts logged value is 1.0 GW for a constant 1000 MW offset.
FIX 2: plot_shap_summary docstring notes the figure is harvested
via plt.gcf() (shap API limitation), the function is not
thread-safe, and callers must close the returned figure before
other pyplot work.
FIX 3: plot_shap_summary docstring replaces "at most max_samples
rows" with the precise stride description.
FIX 4: Remove feature_family from plots/__init__.py re-exports
and __all__; it is a string classifier, not a plot function.
Remains public at spotforecast2.plots.diagnostics.feature_family.
Tests already used the full module path — no changes needed there.
FIX 5: Remove dead n_annotated variable in plot_acf_with_lags.
FIX 6: Remove per-example matplotlib.use("Agg") calls from the
four docstring Examples; examples still avoid plt.show().
FIX 7: Add two feature_family precedence cases to the parametrized
table: "poly_window_24" -> "polynomial" and "sin_window" ->
"weather_window", pinning holiday > poly > window > cyclical > lag.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…and boundary helpers FIX 1 (_quarto.yml): remove invalid `stats.select_pacf_lags` quartodoc contents entry and matching sidebar item; select_pacf_lags is a function inside stats/autocorrelation, already rendered as a section of stats.autocorrelation.qmd. Delete stale docs/reference/stats.select_pacf_lags.qmd. FIX 2 (boundary.py): expand module docstring with a prominent paragraph contrasting the two key-prefix conventions (report_boundary_positions strips "estimator__", boundary_report/suggest_bounds use full keys). Add logger.warning in boundary_report when result is empty but search_space contains numeric tuple dims, suggesting a key-convention mismatch. FIX 3 (uv.lock): restore uv.lock to develop's version; branch-specific lock hunk dropped. FIX 4 (test_model_selection_boundary.py): change test_all_keys_preserved to use "estimator__"-prefixed best_params so the flagged/widened code path is actually exercised; add asserts that the near-upper-boundary integer dim was widened and the interior log dim is unchanged. FIX 5 (test_stats_select_pacf_lags.py): remove dead `except ValueError: pass` arm from test_very_short_series_fallback (never raises with fallback given); add separate test_very_short_series_no_fallback_raises asserting ValueError on constant series without fallback. FIX 6 (boundary.py): add `if isinstance(val, bool): continue` guard in boundary_report mirroring report_boundary_positions; note boolean skip in docstring. FIX 7 (autocorrelation.py): coerce fallback elements to int via `[int(x) for x in fallback]`; note the coercion in the fallback param docstring. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…acf-boundary feat(model_selection): PACF lag selection + search-space boundary helpers
…iagnostics-plots feat(plots): operational diagnostics plots
| flag = ( | ||
| "> upper" | ||
| if pos > 1 - warn_frac | ||
| else ("< lower" if pos < warn_frac else "") |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
## [8.1.0-rc.1](v8.0.0...v8.1.0-rc.1) (2026-06-12) ### Features * **plots:** operational diagnostics plots (ACF, importance-by-family, SHAP summary, forecast-vs-reference) ([0bbc0c6](0bbc0c6)) * **stats:** PACF lag selection + search-space boundary report ([c8079b2](c8079b2)) ### Bug Fixes * **plots:** apply code-review fixes to diagnostics.py ([5a7857c](5a7857c)) * **stats,model_selection:** code-review fixes for PACF lag selection and boundary helpers ([62af0dd](62af0dd))
Collaborator
Author
|
🎉 This PR is included in version 8.1.0-rc.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Collaborator
Author
|
🎉 This PR is included in version 8.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Promotes develop → main for the 8.1.0 release:
select_pacf_lags— significance-band top-k PACF lag pick (upstreamed from the team4 operational script)boundary.py—report_boundary_positions,boundary_report,suggest_bounds(promoted from the ch14 qmd prototypes; closes the KB boundary-management follow-up)diagnostics.py— ACF-with-lags, importance-by-family, SHAP summary, forecast-vs-reference figuresUnion verified locally: 1257 tests green, consumer-contract test green, full quarto render green on both feature branches.
🤖 Generated with Claude Code