Skip to content

Bayesian ets

polars_ts.models.bayesian_ets

Bayesian Exponential Smoothing (Bayesian ETS).

BayesianETS

Bayesian Exponential Smoothing forecaster.

fit(df)

Fit the Bayesian ETS model.

predict(df, h)

Generate h-step-ahead forecasts with credible intervals.

BayesianETSResult dataclass

Fitted result from BayesianETS.

ETSPriors dataclass

Prior distributions for ETS smoothing parameters and initial states.

_forecast_from_params(values, params, model, m, additive, h, sigma_noise=False, rng=None)

Run ETS forward to get h-step forecasts from fitted parameters.

_holt_loglik(values, alpha, beta, level0, trend0, sigma)

Gaussian log-likelihood for Holt's linear trend model.

_hw_loglik(values, alpha, beta, gamma, level0, trend0, seasons0, m, additive, sigma)

Gaussian log-likelihood for Holt-Winters model.

_log_posterior(theta, values, model, m, additive, priors)

Compute unnormalized log-posterior.

_map_estimate(values, model, m, additive, priors)

Find MAP estimate via L-BFGS-B.

_mcmc_sample(values, model, m, additive, priors, n_samples=1000, burn_in=500, seed=42)

Draw posterior samples via Metropolis-Hastings.

_pack_params(model, alpha, beta, gamma, level0, trend0, seasons0, sigma)

Pack parameters into a flat array for optimization.

_ses_loglik(values, alpha, level0, sigma)

Gaussian log-likelihood for SES state-space model.

_unpack_params(theta, model, m)

Unpack flat parameter array into named parameters.

bayesian_ets(df, h, model='ses', inference='map', season_length=1, seasonal='additive', priors=None, coverage=0.9, n_samples=1000, burn_in=500, seed=42, target_col='y', id_col='unique_id', time_col='ds')

Bayesian ETS convenience function.