Skip to content

Fix HyperTreeSTL short-horizon forecasts#12

Closed
janrth wants to merge 2 commits into
StatMixedML:mainfrom
janrth:feat/stl_short_h
Closed

Fix HyperTreeSTL short-horizon forecasts#12
janrth wants to merge 2 commits into
StatMixedML:mainfrom
janrth:feat/stl_short_h

Conversation

@janrth

@janrth janrth commented Jul 12, 2026

Copy link
Copy Markdown

Fixes #10.

Summary

  • Cap the default STL smoothing window by the current sequence length so reflect padding is valid for short forecast horizons.
  • Bypass smoothing for a one-step horizon, where reflect padding cannot be applied.
  • Repeat reflected seasonal values when centering short horizons whose length is smaller than the STL period.
  • Add regression coverage for fcst_h=3 and fcst_h=1.

Tests

  • .venv/bin/python -m pytest tests/test_hypertree_stl.py -q
  • .venv/bin/python -m pytest -q

@janrth

janrth commented Jul 12, 2026

Copy link
Copy Markdown
Author

@kashif

@janrth
janrth marked this pull request as ready for review July 12, 2026 15:53

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 970ce1bac6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread hypertrees/models/HyperTreeSTL.py
@janrth

janrth commented Jul 12, 2026

Copy link
Copy Markdown
Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: bb090810e1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@StatMixedML

Copy link
Copy Markdown
Owner

Thanks a lot for the detailed report in #10 and for taking the time to put up a fix with tests, @janrth, really appreciated.

It turns out this same short-horizon crash was already addressed independently on our conformal branch back in 8c186ed (2026-06-10), as part of the STL rework. That branch applies the same three fixes you identified:

  • caps the default smoothing window by the sequence length (K = min(max_w_model, 2*T - 1)) so reflect padding stays valid,
  • bypasses smoothing for the one-step case (T ≤ 1),
  • ping-pongs the reflected seasonal values when centering horizons shorter than the STL period.

Because the two fixes overlap, I'm going to close this PR as superseded to avoid a conflicting duplicate, but your end-to-end fcst_h=3 / fcst_h=1 regression tests are actually a nicer, more faithful guard than the unit-level test currently on conformal, so I'd like to encouruage you to open a new PR with the test only.

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.

HyperTreeSTL default forecast fails for short horizons

2 participants