intive-DataScience / tbats

BATS and TBATS forecasting methods
MIT License
178 stars 19 forks source link

Model takes long time to fit my data. #1

Closed MonishMohanB closed 5 years ago

MonishMohanB commented 5 years ago

I am working on the time series data which is having five minute interval like below. 2018-01-01 03:00:00,20 2018-01-01 03:05:00,16 2018-01-01 03:10:00,16 2018-01-01 03:15:00,13 2018-01-01 03:20:00,15 2018-01-01 03:25:00,18

from tbats import TBATS, BATS estimator = TBATS(seasonal_periods=(1,7)) # To capture Daily and weekly seasonality model = estimator.fit(y_to_train)

.fit function takes too much time with warnings "c:\users***\appdata\local\programs\python\python36\lib\site-packages\tbats\transformation\BoxCox.py:38: RuntimeWarning: overflow encountered in power return np.sign(yy) * (np.abs(yy) ** (1 / lam))"

Is there any issue with the model or parameters? issue1

cotterpl commented 5 years ago

Hi, thanks for report.

The warning that you are seeing means that one of the final model candidates produces utterly bad forecasts and will most likely be ignored. I need to correct the code so that it does not produce warning in such a case.

Warning comes from Box-Cox transformation so I suggest to turn it off (use_box_cox=False). You can also try applying this transformation manually before sending the data to model.

TBATS is not a very quick method and may be utterly slow if your time series is long. The things that slow it the most are: Box-Cox and ARIMA. Try running the model with use_box_cox=False and use_arma_errors=False. Once TBATS finishes you can check other parameters of TBATS that were chosen (whether trend and damping is used) and re-run it with those parameters but turning on box-cox, then turning on arma errors.

I am afraid that you are providing invalid seasonal_periods. seasonal_periods should provide number of observations per season. If your data is from 5 minute intervals then a daily seasonality contains 60/524=288 observations (this does not account for daylight saving time changes). The weekly seasonality consists of 60/524*7=2016 observations.

cotterpl commented 5 years ago

I have merged a correction so that this warning is not being displayed and such model candidates are not being considered to become a final model.