facebook / prophet

Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.
https://facebook.github.io/prophet
MIT License
18.53k stars 4.54k forks source link

Seeking clarification on setting custom holiday prior scale #2555

Open aidanhor-n opened 9 months ago

aidanhor-n commented 9 months ago

*EDIT: The questions I have are specifically about this line in the docs. _You can also include a column priorscale to set the prior scale separately for each holiday, as described below.

prior_scale syntax Assuming I have a holidays dataframe as shown in the docs with an additional holiday flag called 'christmas', is the following an appropriate way to set different prior_scales?

holidays['prior_scale'] = 0.1
holidays.loc[holidays['holiday'] == 'christmas', 'prior_scale'] = 10

intended effect The snippet from my fitted forecast below shows a consistent underestimation of the holiday effect for christmas.

image

Assuming the above syntax is correct, I have tried increasing the prior_scale to increase the flexibility of the 'christmas' holiday fit in hopes it will approach the actual. However, I have tried some reasonable priors (0.5, 1, 10) as well as 1000 and noticed no difference in the final effect.

Any insight would be appreciated here. Thank you.

imad24 commented 9 months ago

holidays_prior_scale is a hyperparameter of the model that you set when you instantiate the Prophet model:

m = Prophet(holidays=holidays, holidays_prior_scale=0.05).fit(df)

More info here in the docs.

You don't need to set it in the dataframe. However, it will apply to all the "holidays regressors". To my knowledge, you cannot set it by type of holidays.

aidanhor-n commented 9 months ago

holidays_prior_scale is a hyperparameter of the model that you set when you instantiate the Prophet model:

m = Prophet(holidays=holidays, holidays_prior_scale=0.05).fit(df)

More info here in the docs.

You don't need to set it in the dataframe. However, it will apply to all the "holidays regressors". To my knowledge, you cannot set it by type of holidays.

The docs do say _"You can also include a column priorscale to set the prior scale separately for each holiday, as described below" and _"Prior scales can be set separately for individual holidays by including a column priorscale in the holidays dataframe". There just doesn't seem to be any actual examples of this that I could find in the docs.