Skip to content

fix: predict output quality — stray y, index-keyed intervals, horizon cap (#536) - #548

Closed
Shashankss1205 wants to merge 1 commit into
mainfrom
fix/536-predict
Closed

Shashankss1205 wants to merge 1 commit into
mainfrom
fix/536-predict

Conversation

@Shashankss1205

Copy link
Copy Markdown
Collaborator

Fixes #536. Three predict output-quality issues:

NB-18 — y forwarded to non-annotators (raw TypeError)

predict(..., y_dataset=...) on a forecaster raised BaseForecaster.predict() got an unexpected keyword argument 'y'. y at predict is only for annotators/detectors; it's now passed only when predict's signature accepts it, and otherwise dropped with a warnings entry explaining why.

NB-21 — interval/variance modes dropped the time index

predict_interval / predict_var serialized the DataFrame with orient="list", so values came back as bare arrays with no time labels — while predict keys by period. Switched to orient="index", so every mode is index-keyed:

"intervals": {"1961-01": {"...0.8_lower": 357.3, "...0.8_upper": 476.7}, ...}

NB-22 — unbounded horizon flooded the response

predict(horizon=1000) returned 1000 inline rows. Inline forecast rows are capped at 500 with a predictions_truncated: {shown, total, note} marker; normal horizons are never affected.

Testing

  • New tests/test_predict_output.py (5 tests): stray y dropped with a warning (not a crash); predict_interval and predict_var are index-keyed dicts; horizon=1000 capped with a marker; horizon=12 untouched.
  • Full suite: 280 passed.

🤖 Generated with Claude Code

… cap (#536)

- NB-18: y was forwarded to every estimator's predict; forecasters raised a raw
  "unexpected keyword argument 'y'" TypeError. Pass y only when predict's
  signature accepts it (annotators); otherwise drop it and add a warning.
- NB-21: predict_interval / predict_var serialized the DataFrame with
  orient="list", dropping the time index so values were bare arrays. Use
  orient="index" so every mode is index-keyed like predict.
- NB-22: an unbounded horizon (e.g. 1000) returned all rows inline. Cap inline
  forecast rows at 500 with a predictions_truncated marker; normal horizons are
  unaffected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Shashankss1205

Copy link
Copy Markdown
Collaborator Author

Closing: this PR's content is already on main as commit 4d870f0 (identical patch-id; it was landed directly rather than through the PR merge button). Nothing further to merge.

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.

[BUG] predict: forwards y to non-annotators, drops time index in interval/var modes, unbounded horizon

1 participant