kats.models.theta module¶

Implementation of theta model which is basically a simple exponential smoothing model with drift.

For more details refer to: https://robjhyndman.com/papers/Theta.pdf

class kats.models.theta.ThetaModel(data: Optional[kats.consts.TimeSeriesData] = None, params: Optional[kats.models.theta.ThetaParams] = None)[source]¶

Bases: Generic[kats.models.model.ParamsType]

Model class for Theta

This class provides fit, predict, and plot methods for STLF model

data¶

the input time series data as kats.consts.TimeSeriesData

params¶

the parameter class defined with ThetaParams

check_seasonality()None[source]¶

Determine if the metirc to be forecasted is seasonal or not

deseasonalize()kats.consts.TimeSeriesData[source]¶

Returns the deseasonalized input time series

fit(**kwargs)None[source]¶

Fit Theta model

static get_parameter_search_space()List[Dict[str, Any]][source]¶

Provide a parameter space for Theta model

Move the implementation of get_parameter_search_space() out of arima to avoid the massive dependencies of arima and huge build size.

plot()[source]¶

Plot forecasted results from Theta model

predict(steps: int, include_history=False, **kwargs)pandas.core.frame.DataFrame[source]¶

Predict with the fitted Theta model

Parameters
  • steps – Number of time steps to forecast

  • include_history – If True, fitted values for training data are also returned

  • freq – optional, frequency of timeseries data. Defaults to automatically inferring from time index.

  • alpha – optional, significance level of confidence interval. Defaults to 0.05

Returns

time, fcst, fcst_lower, and fcst_upper

Return type

DataFrame of predicted results with following columns

class kats.models.theta.ThetaParams(m: int = 1)[source]¶

Bases: kats.consts.Params

Parameter class for Theta model

This is the parameter class for Theta forecasting model.

m¶

Number of observations before the seasonal pattern repeats For ex, m=12 for montly data with yearly seasonality

validate_params()[source]¶

Validate the parameters for theta model