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.32k stars 4.52k forks source link

Need to the future value of external regressors in order for the model to predict future #1561

Closed mcui123 closed 4 years ago

mcui123 commented 4 years ago

Hi there,

I have a question re: external regressors.

Let's say I have 1000 days of historical data and I am using Prophet to predict the 30 days in the future.

When I am training the historical data, I can easily set 800 days of data to be my training set, 200 days of data to be my testing set. I use X1, X2, X3 as my external regressors (I have real data points for those external regressors in those 1000 days) and the Prophet model works perfectly fine with very good accuracy on testing set. The model does not perform well when I am only using time as the regressor (i.e. no external regressors).

What intrigues me is that, if I am projecting out 30 days into the future (I do not have the values of the external regressors for those 30 days, because that is future yet to happen), I can only use time as the regressor. Then what is the significance of using external regressors to train historical data in the first place, if I need to know the future values of external regressors in advance in order for the future prediction to be accurate?

Thanks so much in advanced for your help!

Best Regards.

hansukyang commented 4 years ago

A good example of using external regressors is for weather-related forecasting, for instance for electricity consumption. Here, you'd feed in the weather forecast as your X1, X2, X3 regressors (e.g. temperature, humidity, wind speed), which you'd also have historical information of. So obviously the quality of the weather forecast will affect your forecast but this is sort of the general idea.

bletham commented 4 years ago

@hansukyang Great answer! This question has come up a few times so we should probably add some discussion of it to the documentation. There's some more discussion of it here too: https://github.com/facebook/prophet/issues/1473#issuecomment-624351199

hansukyang commented 4 years ago

@bletham - thanks! I use this type of analysis quite frequently, where weather parameters play a big factor. I'm not sure if it's appropriate to mention it here but I'm currently beta-testing a weather API for this very purpose (https://oikolab.com) to make it easier for analysts to get time-series weather parameters for both historical and future. Perhaps I can come up with some examples to share.

hansukyang commented 4 years ago

Not quite a forecasting example but here's an example with household electricity consumption:

  1. Model fit without external regressor: baseline

  2. Model fit with temperature as external regressor (i.e. due to temperature dependent heating/cooling load): temperature-added

bletham commented 4 years ago

@hansukyang that's a really cool example, thanks for sharing!

bletham commented 4 years ago

the documentation update this was left open for has been made in https://facebook.github.io/prophet/docs/seasonality,_holiday_effects,_and_regressors.html#additional-regressors