feat(model_selection): PACF lag selection + search-space boundary helpers#214
Merged
Conversation
- 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>
…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>
| 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! |
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.
Upstreams the team4 operational helpers (KB follow-up 2026-06-08-hyperparameter-boundary-management):
stats.autocorrelation.select_pacf_lags— significance-band top-k PACF lag pick (caller-supplied fallback or ValueError)model_selection.boundary—report_boundary_positions(get_params-style keys, log/return-only),boundary_report+suggest_bounds(promoted from the ch14 qmd prototypes; SpotOptim-result-style keys). Dual key convention documented at module level + runtime mismatch warning.Reviewed (2 blockers + 3 importants + 3 nits resolved). Full pipeline green incl. quarto render.
🤖 Generated with Claude Code