Skip to content

FourierTransform #292

Closed
1 task done
Mr-Geekman opened this issue Nov 17, 2021 · 0 comments · Fixed by #306
Closed
1 task done

FourierTransform #292

Mr-Geekman opened this issue Nov 17, 2021 · 0 comments · Fixed by #306
Assignees
Labels
enhancement New feature or request

Comments

@Mr-Geekman
Copy link
Contributor

Mr-Geekman commented Nov 17, 2021

🚀 Feature Request

Add FourierTransform, that creates fourier features.

Motivation

It can help to deal with multiple and non-integer seasonalities.

Proposal

Add FourierTransform, that creates fourier features.

Parameters:

  • period: float: the period of the seasonality to capture in frequency units of time series (must be >= 2, can be float to support not regular seasonality, for example year seasonality in weekly data);
  • order: int: number of Fourier components to include (must be <= 2*period).

Fourier k-th component:

s_k(t) = \sin \left( 2 pi k \frac{t}{p f} ​\right)
c_k(t) = \cos \left( 2 pi k \frac{t}{p f} ​\right)

where p - period, f - freq of time series, t - time from the "zero" of the period (can be the beginning of the series).

It will be better to do it without PerSegmentWrapper.

Use Fourier and CalendarFourier for reference.

To take care of names of the columns we want to create more precise object constructor, that can create one particular column (its repr will be the default name of the column). For example, it will take in:

  • period
  • mods: list of components, that distinguishes sin and cos.

For example mods=[0, 1, 2] creates s_1, c_1, s_2.

The constructor with order can reuse this precise constructor.

Parameter out_column is a prefix name for all the columns and single columns are separated by _{number} suffix (like in LagTransform).

Test cases

  1. Columns with expected names are added with out_column and without out_column parameter. (It can be better to test general and specific constructors separately).
  2. Values are expected (test integer and float periods).
  3. Constraints are satisfied for period and mods (may be be possible to also check order here, but it can be managed inside constructor with mods).
  4. Sanity check example with two seasonalities. We are going to catch them by using only this transform two times.

Alternatives

No response

Additional context

No response

Checklist

  • I discussed this issue with ETNA Team
@Mr-Geekman Mr-Geekman added the enhancement New feature or request label Nov 17, 2021
@Mr-Geekman Mr-Geekman self-assigned this Nov 22, 2021
@Mr-Geekman Mr-Geekman mentioned this issue Nov 23, 2021
9 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant