Add RBFSeasonality
Closed this issue · 4 comments
I have been working on this feature, and had chance to play with it on some highly seasonal series. If you think this would be a nice feature, I can wrap it up, open a PR and hopefully share some plots.
Sounds good!
I was trying to compare the RBFSeasonality with FourierSeasonality with the air passengers dataset. However, I am not able to reproduce the results in the readme. This is is what I am getting:
import pandas as pd
from timeseers import FourierSeasonality, LinearTrend
passengers = pd.read_csv('AirPassengers.csv').reset_index().assign(
t=lambda d: pd.to_datetime(d['Month']),
value=lambda d: d['#Passengers']
)
model = LinearTrend(n_changepoints=10) * FourierSeasonality(n=5, period=pd.Timedelta(days=365))
model.fit(passengers[['t']], passengers['value'], tune=2000)
model.plot_components(X_true=passengers, y_true=passengers['value']);
Dataset: https://www.kaggle.com/rakannimer/air-passengers
Fits very fast (10 seconds), and no divergences. I might be missing something here. Do you have any ideas?
hm, I do remember this. It has to do with the multiplicative seasonality and the scaling of the data. Can you change the y-scaler to a MinMaxScaler and see whether the same occurs there?
Okay thanks a lot, it is great now. It seems like the negative values resulted by the StdScaler result in this problem.
For the sake of completeness, here is the results now:
import pandas as pd
from timeseers import FourierSeasonality, LinearTrend
passengers = pd.read_csv('AirPassengers.csv').reset_index().assign(
t=lambda d: pd.to_datetime(d['Month']),
value=lambda d: d['#Passengers']
)
model = LinearTrend(n_changepoints=10) * FourierSeasonality(n=5, period=pd.Timedelta(days=365))
model.fit(passengers[['t']], passengers['value'], tune=2000, y_scaler=MinMaxScaler)
model.plot_components(X_true=passengers, y_true=passengers['value']);