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

Prophet Model Underforecasting #840

Closed
ahash52 opened this issue Feb 5, 2019 · 3 comments
Closed

Prophet Model Underforecasting #840

ahash52 opened this issue Feb 5, 2019 · 3 comments

Comments

@ahash52
Copy link

ahash52 commented Feb 5, 2019

My prophet model seems to be underforecasting for forecasted values.

I tried adding holidays with dates where we see the spikes. It did help a little bit, but my model continues to underforecast. Are there any suggestions on how to improve this?

final_model <-
prophet(
#seasonality.mode = 'multiplicative',
seasonality.prior.scale = .002,
changepoint.prior.scale = .02,
n.changepoints = 20,
changepoint.range = .9,
holidays = holidays,
yearly.seasonality = TRUE
) %>%
add_regressor('regressor1', mode = 'multiplicative') %>%
add_regressor('regressor2', mode = 'multiplicative') %>%
fit.prophet(mydata)

prophet

@bletham
Copy link
Contributor

bletham commented Feb 9, 2019

The model has an assumption that the sizes of holiday and seasonal effects are constant (whether that be constant additive or constant multiplicative). In this case, the size of the effect on that day is growing. If it is growing at the same rate as the trend, that means it is still constant but with multiplicative seasonality. That seems to be the case for later years, but is not the case for the growth from 2011 to 2012. The effect was very weak in 2011 and very strong in 2012.

For that holiday, the model will fit an effect size that is something like that average of the effects seen through the history. In this case, the very small effect in 2011 is causing it to fit a smaller effect for all of them and biasing it downwards for the later years. If there was something about 2011 that made it different, then you can just give 2011 a separate holiday from the others and then it will be free to fit a 2012-2019 effect that is more consistent with what is seen in those years.

@ahash52
Copy link
Author

ahash52 commented Feb 13, 2019

Hi @bletham,

Thank you for your response.

That makes sense. So right now, I have called out holidays as the following:

christmas <- data_frame(ds = as.Date(c('2010-12-31', '2012-12-31', '2013-12-31', '2014-12-31', '2015-12-31', '2016-12-31', '2017-12-31', '2018-12-31')),
holiday = 'Christmas')

christmas_2011 <- data_frame(ds = as.Date(c('2011-12-31')), holiday = 'Christmas 2011')

holidays <- rbind(christmas, christmas_2011)

Still seeing some under-forecasting though. Any specific parameters that I can change to change how it under forecasts (possibly make it over-forecast)?

m <-
prophet(
#seasonality.mode = 'multiplicative',
seasonality.prior.scale = .04,
changepoint.prior.scale = .05,
n.changepoints = 23,
changepoint.range = .9,
holidays = holidays,
holidays.prior.scale = 35,
yearly.seasonality = TRUE
) %>%
add_regressor('regressor', mode = 'multiplicative') %>%
fit.prophet(mydata)

prophet plot

@bletham
Copy link
Contributor

bletham commented Feb 15, 2019

In this case it's fitting pretty well 2012, 13, 16, and 18. The values in 14, 15, and 17 are higher, and there's no way for the model to know that they should be higher. There must be some extra factor that is driving the increase besides just month (which is the only thing the yearly seasonality is capturing), and you'd need to add an extra regressor that captures whatever it is that is different between, e.g., 2015 and 2016.

@bletham bletham closed this as completed Mar 9, 2019
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

2 participants