kats.models.holtwinters module¶
The Holt Winters model is a time series forecast model that applies exponential smoothing three times, it serves as the extension of the simple exponential smoothing forecast model.
More details about the different exponential smoothing model can be found here: https://en.wikipedia.org/wiki/Exponential_smoothing In this module we adopt the Holt Winters model implementation from the statsmodels package, full details can be found as follows: https://www.statsmodels.org/dev/generated/statsmodels.tsa.holtwinters.ExponentialSmoothing.html We rewrite the corresponding API to accommodate the Kats development style
- class kats.models.holtwinters.HoltWintersModel(data: kats.consts.TimeSeriesData, params: kats.models.holtwinters.HoltWintersParams)[source]¶
Bases:
Generic
[kats.models.model.ParamsType
]Model class for the HoltWinters model
- data¶
kats.consts.TimeSeriesData
, the input historical time series data from TimeSeriesData
- params¶
The HoltWinters model parameters from HoltWintersParams
- static get_parameter_search_space() → List[Dict[str, Any]][source]¶
Get default HoltWinters parameter search space.
- Parameters
None –
- Returns
A dictionary with the default HoltWinters parameter search space
- predict(steps: int, include_history: bool = False, **kwargs) → pandas.core.frame.DataFrame[source]¶
Predict with fitted HoltWinters model
If the alpha keyword argument is specified, an empirical confidence interval is computed through a K-fold cross validation and a linear regression model, the forecast outcome will include a confidence interval there; otherwise no confidence interval is included in the final forecast. Please refer to the ‘emp_confidence_int’ module for full detailed implementation of the empirical confidence interval computation
- Parameters
steps –
include_history –
- Returns
A pd.DataFrame with the forecast and confidence interval (if empirical confidence interval calculation is triggered)
- class kats.models.holtwinters.HoltWintersParams(trend: str = 'add', damped: bool = False, seasonal: Optional[str] = None, seasonal_periods: Optional[int] = None)[source]¶
Bases:
kats.consts.Params
Parameter class for the HoltWinters model
Not all parameters from the statsmodels API have been implemented here, the full list of the parameter can be found: https://www.statsmodels.org/dev/generated/statsmodels.tsa.holtwinters.ExponentialSmoothing.html
- trend¶
Optional; A string that specifies the type of trend component. Can be ‘add’ and ‘mul’ or ‘additive’ and ‘multiplicative’. Default is ‘add’
- damped¶
Optional; A boolean indicates whether the trend should be damped or not. Default is False
- seasonal¶
Optional; A string that specifies the type of seasonal component Can be ‘add’ and ‘mul’ or ‘additive’ and ‘multiplicative’. Default is None
- seasonal_periods¶
Optional; An integer that specifies the period for the seasonal component, e.g. 4 for quarterly data and 7 for weekly seasonality of daily data. Default is None