kats.models.stlf module¶

STLF forecasting model

This model starts from decomposing the time series data with STL decomposition then it fits individual foreasting model on the de-seasonalized components it re-seasonalizes the forecasted results with seasonal data to produce the final forecasting results.

class kats.models.stlf.STLFModel(data: kats.consts.TimeSeriesData, params: kats.models.stlf.STLFParams)[source]¶

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

Model class for STLF

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 STLFParams

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

De-seasonalize the time series data

Parameters

None –

Returns

The seasonal and de-seasonalized data

fit(**kwargs)None[source]¶

Fit STLF model

Parameters

None –

Returns

The fitted STLF model object

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

Provide a parameter space for STLF model

Move the implementation of get_parameter_search_space() out of stlf to keep HPT implementation tighter, and avoid the dependency conflict issue.

Parameters

None –

Returns

List of dicts contains parameter search space

plot()[source]¶

plot forecasted results from Prophet model

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

predict with the fitted STLF model

Parameters
  • steps – the steps or length of prediction horizon

  • include_history – if include the historical data, default as False

Returns

time, fcst, fcst_lower, and fcst_upper

Return type

The predicted dataframe with following columns

class kats.models.stlf.STLFParams(method: str, m: int)[source]¶

Bases: kats.consts.Params

Parameter class for Prophet model

This is the parameter class for STLF model, stands for STL-decomposition based forecasting model.

method¶

str, the forecasting model to fit on the de-seasonalized component it currently supports prophet, linear, quadratic, and theta method.

m¶

int, the length of one seasonal cycle

validate_params()[source]¶

Validate the parameters for STLF model