# Random Forest/ Neural Networks for Time Series Data with Large Seasonality

I have been trying to perform Forecasting of a univariate Time Series Data with "daily" recorded observations and exhibiting an "annual" seasonality. The image below depicts the mentioned series:

While I have achieved success using Statistical Methods, I wish to compare the same with ML/DL Techniques. Following suggestions on this thread, I looked into the M5 Competition and the Winner's Submission, but soon realized something: Do Random Forest Models capture Large seasonality efficiently?

The submissions created variables on lagged values, rolling averages, date parts etc. but in order to capture Annual Seasonality they would require lags up to the order of 365; following SARIMA Order, maybe even more. So, how would you apply a Random Forest method in order to "capture seasonality" of such high order. While this is plausible by de-seasoning the series before ingesting in model, I was more curious to figure out how would one do so using only Random Forest! The same question expands to Neural Nets as well! Please share your opinions on the same!!

• You could try a feature "value 1 year ago". Commented Oct 1, 2023 at 14:21
• @MichaelM Thank you for replying! You see, there are at least 2 issues with a feature "Value 1 year ago": 1) There is too much granularity/specificity in that assumption; For instance, its like saying just because it rained the most on July 21st of 2021, the peak will reoccur on the same date for all the coming years. Instead, I believe ideally, a model should capture the essence of seasonality, which is like the sine curve in this case (July Rainfall Peak rather than 21st July peak). 2) Creating a lag like that would also mean giving up on a year's worth of data. Commented Oct 1, 2023 at 15:13
• Perhaps try including a bunch of Fourier terms corresponding to yearly seasonality as in Hyndman "Forecasting with long seasonal periods". Commented Oct 1, 2023 at 15:33
• @RichardHardy Thanks for the suggestion! I have actually achieved the desired results using DHR and TBATS, as the blog suggests, but didn't really thought of using Fourier Terms as Variables. However, I was more interested in knowing whether Decision Trees would be able to "pick up" the seasonality, based on the Time Series and a few other parameters, on its own. Regardless, I will definitely try out your suggestion, but before that, could you help me understand one thing; While Regressing on the Fourier Terms, is the objective to construct the Amplitude of each Fourier Term (finding Beta)? Commented Oct 1, 2023 at 16:59
• @jazz_razz, yes, I think it is. And if some betas are estimated to be close to zero, perhaps these terms can be excluded. Commented Oct 1, 2023 at 17:20