I am trying to use Holt-Winters method in order to do time-series prediction on some datasets. The problem that I'm dealing with is the fact that each dataset has different seasonality value (or frequency basically). As an example, in one dataset the trend occurs every 300 timesteps while for another one this might be a different number. Assuming that I do not have the option of visualizing data each time to find out about the seasonality of my data, what would be the best way for finding the optimal value of frequency to get the best performance from Holt-Winters? Note that I receive about 500 out of 4000 samples to train my model.

My approach: Split train data to train and validation subsets. Use different seasonality values on train and evaluate performance on validation. For now, I think I'll use random search to find the best value such that it minimizes the prediction error on validation set. I was wondering if there are any other practical methods or approaches that any of you might be aware of?

UPDATE: I have to mention that I have to implement this only in python and not R, so the findfrequency() function from forecast package is applicable here.

  • $\begingroup$ Rob J. Hyndman has an algorithm for finding frequency based on spectral decomposition, as described in his blog post "Measuring time series characteristics". $\endgroup$ Aug 1 '16 at 18:30
  • $\begingroup$ @RichardHardy thanks for your feedback but I'm not using R and would like something preferably in python. So implementing this in python is not what I'm looking for. $\endgroup$
    – ahajib
    Aug 1 '16 at 19:56
  • $\begingroup$ Software implementation is unfortunately off topic here. Probably you could still try to understand the R code to get the idea, then you could recode it in another language if you wish to. See also my answer here. $\endgroup$ Aug 2 '16 at 9:27
  • $\begingroup$ @RichardHardy That is correct, but my question is not a programming or implementation problem. Btw, I tried the findfrequency function just to have an estimation of frequency of my data and unfortunately, it is not close to the actual value. $\endgroup$
    – ahajib
    Aug 2 '16 at 13:45
  • $\begingroup$ I see, sorry about that. Probably Rob J. Hyndman would be interested in that if you can supply your data to make the example reproducible. I suppose he would like to see cases where the algorithm fails so as to be able to improve the algorithm. $\endgroup$ Aug 2 '16 at 13:53