from pmdarima.pipeline import Pipeline from pmdarima.preprocessing import FourierFeaturizer pipeline = Pipeline([ ("fourier_1", FourierFeaturizer(m=7, k=1)), ("fourier_2", FourierFeaturizer(m=14, k=1)), ]) pipeline.fit_transform(df['value'])
When I run above code. I get following error: TypeError: Last step of Pipeline should be of type BaseARIMA. 'FourierFeaturizer(k=1, m=14)'
I don’t wish to use BaseARIMA. Just wish to use FourierFeaturizer is it possible?
Advertisement
Answer
Yes, it’s possible.
Each FourierFeaturizer has a fit_transform method, which returns the y var and new exogenous variables. By concatenating this return value, you get Fourier features.
y, x1 = FourierFeaturizer(m=7, k=2).fit_transform(df[['value']]) y, x2 = FourierFeaturizer(m=365, k=2).fit_transform(y) exog = pd.concat([x1, x2], axis=1)
Warning: If you use m values which are multiples of each other, you will get co-linearity, because the 2nd frequency of m=14 is exactly the same as the 1st frequency of m=7. When using multiple seasonality, make sure their periods are not multiples of each other.