Skip to content

fix: preserve single-knot KTR predictions with uncertainty - #896

Open
Shubham-Padkonde wants to merge 1 commit into
uber:devfrom
Shubham-Padkonde:fix/single-level-knot-prediction
Open

Shubham-Padkonde wants to merge 1 commit into
uber:devfrom
Shubham-Padkonde:fix/single-level-knot-prediction

Conversation

@Shubham-Padkonde

@Shubham-Padkonde Shubham-Padkonde commented Sep 22, 2026 •

Copy link
Copy Markdown

Description

Fixes #816.

KTR prediction with level_segments=0 accesses a nonexistent second level knot when include_error=True. Only extrapolate level knots when at least two knots exist. Single-knot predictions use the existing constant interpolation kernel; observation noise remains enabled.

Regression tests cover in-sample and future dates, one and three posterior samples, and predictions with and without observation noise. They also check that prediction leaves posterior levels unchanged.

Type of change

  • Bug fix

How Has This Been Tested?

  • Before the fix: four regression cases fail with the reported IndexError; four pass.
  • After the fix: python -m pytest tests/orbit/utils/test_knots.py tests/orbit/models/test_ktr.py -k 'single_level_knot or test_knots' -q — 29 passed.
  • black --check orbit/template/ktr.py tests/orbit/models/test_ktr.py — passed.
  • git diff --check — passed.
  • Broader KTR fitting tests stop because this Windows environment has no CmdStan installation. Full-suite success and the required coverage threshold are not verified, and still need verification before merge. The code change is ready for review with these validation limits.

No dependency changes. Prepared with Codex assistance.

@CLAassistant

CLAassistant commented Sep 22, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Shubham-Padkonde
Shubham-Padkonde marked this pull request as ready for review September 22, 2026 05:51

This branch has not been deployed

No deployments
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.

KTR predict method doesn't consider single knot case.

2 participants