Skip to main content

mstl_decomposition

Decompose the series into trend and seasonal using the MSTL model. Parameters:
NameTypeDescriptionDefault
dfpandas or polars DataFrameDataFrame with columns [unique_id, ds, y].required
modelstatsforecast MSTLModel to use for the decomposition.required
freqstrFrequency of the data (pandas alias).required
hintForecast horizon.required
Returns:
TypeDescription
Tuple[DataFrame, DataFrame]Tuple[DataFrame, DataFrame]: A tuple containing: - train_df (pandas or polars DataFrame): Original dataframe with the ‘trend’ and ‘seasonal’ columns added. - X_df (pandas or polars DataFrame): Future dataframe to be provided to the predict method through X_df.