FourierTransform¶
- class FourierTransform(period: float, order: Optional[int] = None, mods: Optional[Sequence[int]] = None, out_column: Optional[str] = None)[source]¶
Bases:
etna.transforms.base.Transform,etna.transforms.base.FutureMixinAdds fourier features to the dataset.
Notes
To understand how transform works we recommend: Fourier series.
Parameter
periodis responsible for the seasonality we want to capture.Parameters
orderandmodsdefine which harmonics will be used.
Parameter
orderis a more user-friendly version ofmods. For example,order=2can be represented asmods=[1, 2, 3, 4]ifperiod> 4 and asmods=[1, 2, 3]if 3 <=period<= 4.Create instance of FourierTransform.
- Parameters
period (float) –
the period of the seasonality to capture in frequency units of time series;
periodshould be >= 2order (Optional[int]) –
upper order of Fourier components to include;
ordershould be >= 1 and <= ceil(period/2))mods (Optional[Sequence[int]]) –
alternative and precise way of defining which harmonics will be used, for example
mods=[1, 3, 4]means that sin of the first order and sin and cos of the second order will be used;modsshould be >= 1 and < periodout_column (Optional[str]) –
if set, name of added column, the final name will be ‘{out_columnt}_{mod}’;
if don’t set, name will be
transform.__repr__(), repr will be made for transform that creates exactly this column
- Raises
ValueError: – if period < 2
ValueError: – if both or none of order, mods is set
ValueError: – if order is < 1 or > ceil(period/2)
ValueError: – if at least one mod is < 1 or >= period
- Inherited-members
Methods
fit(df)Fit method does nothing and is kept for compatibility.
fit_transform(df)May be reimplemented.
inverse_transform(df)Inverse transforms dataframe.
load(path)Load an object.
save(path)Save the object.
to_dict()Collect all information about etna object in dict.
transform(df)Add harmonics to the dataset.
- fit(df: pandas.core.frame.DataFrame) etna.transforms.timestamp.fourier.FourierTransform[source]¶
Fit method does nothing and is kept for compatibility.
- Parameters
df (pandas.core.frame.DataFrame) – dataframe with data.
- Returns
result
- Return type