Skip to content

fix: preserve walkforward warmup counts - #185

Merged
Pigbibi merged 1 commit into
mainfrom
fix/warmup-count-normalization
Sep 13, 2026
Merged

Pigbibi merged 1 commit into
mainfrom
fix/warmup-count-normalization

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator

Problem

When walk-forward predictions exist, joining the aggregated prediction frame leaves prediction_window_count as NaN for the pre-OOS prefix. build_final_scores correctly keeps those rows out of final scoring, but run_single_backtest requires prediction_window_count == 0 to recognize model warmup. The prefix is therefore misclassified as incomplete eligible scores before the first OOS window.

Change

Normalize only unmatched prediction_window_count values to integer 0 after the prediction join. Scores remain untouched; positive prediction counts with missing scores still fail the existing strict guard.

Validation

  • RED: an actual run_walkforward_scoring -> build_final_scores -> run_backtest_suite fake-panel path reproduced ValueError: Backtest has incomplete eligible scores with pre-OOS counts as NaN.
  • GREEN: the same path keeps pre-OOS final_score as NaN, sets counts to 0, and completes the backtest suite.
  • python3 -m unittest discover -s tests: 131 tests OK.
  • python3 -m pytest -q tests/test_walkforward_validation.py tests/test_backtest_accounting.py: 39 passed, 40 subtests passed.
  • python3 -m ruff check . and git diff --check: passed.

No producer/consumer workflow, provider, VPS, or trading operation was run.

Co-Authored-By: Codex <noreply@openai.com>
@Pigbibi
Pigbibi merged commit b56c57e into main Sep 13, 2026
1 check passed
@Pigbibi
Pigbibi deleted the fix/warmup-count-normalization branch September 13, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant