Seasonal decompose features
polars_ts.decomposition.seasonal_decompose_features
seasonal_decompose_features(df, ts_freq, seasonal_freqs=None, mode='simple', id_col='unique_id', time_col='ds', target_col='y')
Perform seasonal decomposition on a time series and compute additional features.
- Trend strength
- Seasonal strength
- Residual variance
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
A Polars DataFrame containing the time series data with the following columns:
|
required |
ts_freq
|
str
|
The frequency of the time series. For example, |
required |
seasonal_freqs
|
Optional[List[int]]
|
A list of seasonal frequencies to use for the MSTL mode. This is required only if |
None
|
mode
|
Literal['simple', 'mstl']
|
The decomposition mode, one of {'simple', 'mstl'}. Defaults to 'simple'. |
'simple'
|
id_col
|
str
|
The name of the column that identifies each individual time series within the DataFrame.
Defaults to |
'unique_id'
|
time_col
|
str
|
The name of the column that contains the time or datetime information for each observation.
Defaults to |
'ds'
|
target_col
|
str
|
The name of the column containing the time series data to be decomposed. Defaults to |
'y'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame containing the following features for each unique
|