find_harmonics
tbats_core.find_harmonics
Find optimal number of harmonics for period m using AIC.
Results are cached by (n, m, sum, std) so warm runs are free.
find_harmonics(y, m)
| Parameter | Type | Default | Description |
|---|---|---|---|
y |
jnp.ndarray |
- | (undocumented) |
m |
int |
- | (undocumented) |
Returns: Tuple[int, jnp.ndarray] (k, z_deseasonalised)
tbats_model_generator
tbats_core.tbats_model_generator
Fit a single TBATS specification (Box-Cox + optimisation + filter).
tbats_model_generator(y, seasonal_periods, k_vector, use_boxcox, bc_lower, bc_upper, use_trend, use_damped_trend, use_arma_errors, ar_coeffs, ma_coeffs, seasonal_blocks=None)
| Parameter | Type | Default | Description |
|---|---|---|---|
y |
jnp.ndarray |
- | (undocumented) |
seasonal_periods |
Sequence[int] |
- | (undocumented) |
k_vector |
jnp.ndarray |
- | (undocumented) |
use_boxcox |
bool |
- | (undocumented) |
bc_lower |
float |
- | (undocumented) |
bc_upper |
float |
- | (undocumented) |
use_trend |
bool |
- | (undocumented) |
use_damped_trend |
bool |
- | (undocumented) |
use_arma_errors |
bool |
- | (undocumented) |
ar_coeffs |
Optional[jnp.ndarray] |
- | (undocumented) |
ma_coeffs |
Optional[jnp.ndarray] |
- | (undocumented) |
seasonal_blocks |
Optional[jnp.ndarray] |
None |
(undocumented) |
Returns: Dict
The returned dictionary contains the following keys:
| Key | Type | Description |
|---|---|---|
fitted |
jnp.ndarray |
Fitted values (one-step ahead predictions). |
errors |
jnp.ndarray |
Filter innovations (errors). |
sigma2 |
jnp.ndarray |
Estimated variance of the innovations. |
aic |
float |
Akaike Information Criterion. |
optim_params |
jnp.ndarray |
Optimised parameter vector. |
F |
jnp.ndarray |
Final transition matrix. |
w_transpose |
jnp.ndarray |
Final observation vector (transposed). |
g |
jnp.ndarray |
Final gain vector. |
x |
jnp.ndarray |
Final state vector (shape (1, d)). |
k_vector |
jnp.ndarray |
Vector of harmonic counts used for each seasonal period. |
BoxCox_lambda |
float |
Optimised Box-Cox lambda, or None. |
p |
int |
AR order. |
q |
int |
MA order. |
ar_coeffs |
Optional[jnp.ndarray] |
Optimised AR coefficients. |
ma_coeffs |
Optional[jnp.ndarray] |
Optimised MA coefficients. |
seed_states |
jnp.ndarray |
Initial state vector used for filtering. |
y_mu |
jnp.ndarray |
(undocumented) |
y_sigma |
jnp.ndarray |
(undocumented) |
description |
Dict |
Empty dictionary (placeholder for model description). |
tbats_model
tbats_core.tbats_model
Convenience wrapper: fit a single TBATS spec with no ARMA.
tbats_model(y, seasonal_periods, k_vector, use_boxcox, bc_lower, bc_upper, use_trend, use_damped_trend, use_arma_errors)
| Parameter | Type | Default | Description |
|---|---|---|---|
y |
jnp.ndarray |
- | (undocumented) |
seasonal_periods |
Sequence[int] |
- | (undocumented) |
k_vector |
jnp.ndarray |
- | (undocumented) |
use_boxcox |
bool |
- | (undocumented) |
bc_lower |
float |
- | (undocumented) |
bc_upper |
float |
- | (undocumented) |
use_trend |
bool |
- | (undocumented) |
use_damped_trend |
bool |
- | (undocumented) |
use_arma_errors |
bool |
- | (undocumented) |
Returns: Dict
Returns the same dictionary structure as tbats_model_generator, but the description key is populated with the input configuration flags.
tbats_selection
tbats_core.tbats_selection
Auto-select the best TBATS configuration via AIC comparison.
tbats_selection(y, seasonal_periods, use_boxcox, bc_lower, bc_upper, use_trend, use_damped_trend, use_arma_errors, early_stop_patience=None, early_stop_tol=0.5)
| Parameter | Type | Default | Description |
|---|---|---|---|
y |
jnp.ndarray |
- | (undocumented) |
seasonal_periods |
Sequence[int] |
- | (undocumented) |
use_boxcox |
Optional[bool] |
- | (undocumented) |
bc_lower |
float |
- | (undocumented) |
bc_upper |
float |
- | (undocumented) |
use_trend |
Optional[bool] |
- | (undocumented) |
use_damped_trend |
Optional[bool] |
- | (undocumented) |
use_arma_errors |
bool |
- | (undocumented) |
early_stop_patience |
Optional[int] |
None |
(undocumented) |
early_stop_tol |
float |
0.5 |
(undocumented) |
Returns: Dict (The fitted model dictionary selected by AIC.)
tbats_forecast
tbats_core.tbats_forecast
Multi-step mean forecast from a fitted model dictionary.
tbats_forecast(mod, h)
| Parameter | Type | Default | Description |
|---|---|---|---|
mod |
Dict |
- | (undocumented) |
h |
int |
- | (undocumented) |
Returns: Dict[str, jnp.ndarray]
The returned dictionary contains the following keys:
| Key | Type | Description |
|---|---|---|
mean |
jnp.ndarray |
The point forecast (inverse Box-Cox transformed if applicable). |
mean_bc |
jnp.ndarray or None |
The point forecast in the Box-Cox transformed space, or None. |
compute_sigmah
tbats_core.compute_sigmah
Parametric forecast standard deviations from a fitted model dictionary.
compute_sigmah(mod, h)
| Parameter | Type | Default | Description |
|---|---|---|---|
mod |
Dict |
- | (undocumented) |
h |
int |
- | (undocumented) |
Returns: jnp.ndarray
tbats_forecast_batch
tbats_core.tbats_forecast_batch
Vectorised forecasts: x_last has shape (B, d).
tbats_forecast_batch(F, w, x_last, h)
| Parameter | Type | Default | Description |
|---|---|---|---|
F |
jnp.ndarray |
- | (undocumented) |
w |
jnp.ndarray |
- | (undocumented) |
x_last |
jnp.ndarray |
- | (undocumented) |
h |
int |
- | (undocumented) |
Returns: jnp.ndarray
compute_sigmah_batch
tbats_core.compute_sigmah_batch
Vectorised sigmah: sigma2 and y_sigma have shape (B,).
compute_sigmah_batch(F, w, g, sigma2, y_sigma, h, use_boxcox)
| Parameter | Type | Default | Description |
|---|---|---|---|
F |
jnp.ndarray |
- | (undocumented) |
w |
jnp.ndarray |
- | (undocumented) |
g |
jnp.ndarray |
- | (undocumented) |
sigma2 |
jnp.ndarray |
- | (undocumented) |
y_sigma |
jnp.ndarray |
- | (undocumented) |
h |
int |
- | (undocumented) |
use_boxcox |
bool |
- | (undocumented) |
Returns: jnp.ndarray