Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing Fourier order in seasonality #667

Closed
dsvrsec opened this issue Aug 29, 2018 · 12 comments
Closed

Changing Fourier order in seasonality #667

dsvrsec opened this issue Aug 29, 2018 · 12 comments

Comments

@dsvrsec
Copy link

dsvrsec commented Aug 29, 2018

I have tried to change Fourier order for yearly and weekly seasonality on the scale of 1.For some data sets there is little but if change in accuracy.Are the default values reliable for forecast.

and also,how changing Fourier order differs from changing seasonality.prior.scale

Thanks

@vhpietil
Copy link

Fourier order determines how narrow spikes yearly (and weekly) component can capture. Try very large values and you might see seasonality changing more rapidly (but possibly overfitting some noise).

I think prior scale affects the height of the seasobality bumps whereas the order affects the width

@bletham
Copy link
Contributor

bletham commented Aug 29, 2018

+1 for what @vhpietil says, and also this is described in the documentation with an example about midway down in https://facebook.github.io/prophet/docs/seasonality,_holiday_effects,_and_regressors.html

@dsvrsec
Copy link
Author

dsvrsec commented Aug 31, 2018

In the documentation,it is mentioned that you have considered default values like 10 yearly seasonality and 3 for weekly seasonality and also mentioned that it can be changed based on the AIC values ,but for a basic user,how he can choose among different values for different time series data sets .Will it be ok to leave the Fourier order to default and also under what situations they can be changed.

@bletham
Copy link
Contributor

bletham commented Aug 31, 2018

Like it says in the documentation, I’d expect in the majority of situations you can leave them at default values. I would only consider changing them if you plot the forecast and can see that there are sharp seasonal fluctuations that the seasonality is too smooth to fit.

@dsvrsec
Copy link
Author

dsvrsec commented Sep 1, 2018

Thanks ,what if I have to build a generalized model for some data sets.How do I arrive to decide on changing the parameters and its range

@bletham
Copy link
Contributor

bletham commented Sep 11, 2018

I think you'd have to experiment with it on your datasets. You can use the cross_validation function to assess model predictions as you change parameter values.

@dsvrsec
Copy link
Author

dsvrsec commented Sep 26, 2018

can you please mention the range of fourier order that can be varied.

@bletham
Copy link
Contributor

bletham commented Sep 27, 2018

It would really depend on the time series. My recommendation would be to (1) identify datasets where the forecast is performing poorly, (2) visualize the forecasts for those datasets, and (3) if it is performing poorly because seasonal fluctuations are more rapid than the seasonality is able to capture, increase the Fourier order until that is no longer the case. This is now a good upper bound for your search.

My prior is that in most cases this number will not benefit much from tuning.

@dsvrsec
Copy link
Author

dsvrsec commented Oct 4, 2018

Thank you for the reply.
But what can we do,if we have many data sets as it may be difficult to visualize every data set .I have tried putting fourier order(from 2 to 10) and changepoint_prior_scale(from 0.01 to 0.1) in loop for 30 data sets and selecting the pair (fourier order,changepoint_prior_scale) for the data set with least test MAPE.Then,different data sets have different corresponding fourier order and changepoint_prior_scale values.Is there any way to generalize this?

@bletham
Copy link
Contributor

bletham commented Oct 6, 2018

If you want to do this in an entirely automated way, then it's a hyperparameter optimization problem. What you describe is one strategy (grid search). Random search often works better (http://www.jmlr.org/papers/volume13/bergstra12a/bergstra12a.pdf) , or there are more sophisticated techniques that you can check out if you search for hyperparameter optimization but I wouldn't think them to be warranted in this situation.

@bletham bletham closed this as completed Oct 16, 2018
@kenny1901
Copy link

what range of values should you normally stay within for Fourier order of the seasonalities and for change prior scale when forecasting time series with prophet?

@bletham
Copy link
Contributor

bletham commented Jul 26, 2019

@kenny1901 see #1009, which has some discussion on this topic.

(and #660 is to provide better documentation for this)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants