Skip to content

feat: expose fixed theta parameter - #1241

Open
Dresden (DresdenGman) wants to merge 1 commit into
Nixtla:mainfrom
DresdenGman:feature/theta-parameter
Open

Dresden (DresdenGman) wants to merge 1 commit into
Nixtla:mainfrom
DresdenGman:feature/theta-parameter

Conversation

@DresdenGman

Copy link
Copy Markdown
Contributor

Summary

  • expose an optional fixed theta parameter on AutoTheta, OptimizedTheta, and DynamicOptimizedTheta
  • propagate it through fit, memory-efficient forecast, and direct simulation fits
  • validate the same finite [1, 1e10] range used by the internal optimizer
  • add fit/forecast parity and validation regression tests

Motivation

The lower-level auto_theta implementation already accepts a fixed theta value and skips theta optimization when it is supplied, but the public model constructors did not expose that capability. Users with a known theta therefore had to pay the optimization cost for every series.

The default remains None, so existing callers continue to estimate theta exactly as before. Standard Theta candidates still use their defined value of 2; the supplied value controls optimized OTM/DOTM candidates.

In a local five-run benchmark on a 1,440-point synthetic seasonal series, fixing theta=2.5 reduced the median OptimizedTheta.forecast fit time from 19.6 ms to 4.62 ms (about 4.25x). This is an indicative local measurement rather than a general performance guarantee.

Validation

  • 235 passed across the new regression file plus the existing Theta and model suites
  • fit/predict and memory-efficient forecast agree for fixed theta across AutoTheta, OTM, and DOTM
  • invalid non-finite and out-of-optimizer-range values raise a clear ValueError
  • Ruff lint passes for every changed file; the new test file passes Ruff formatting
  • diff whitespace validation passes

Closes #860

@codspeed

codspeed Bot commented Sep 21, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 38 untouched benchmarks


Comparing DresdenGman:feature/theta-parameter (08d7f2e) with main (99f2408)

Open in CodSpeed

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.

Theta Parameter to speed up training

1 participant