Prophet: [Question]: Add additional features for forecasting

Created on 22 Apr 2019  ·  9Comments  ·  Source: facebook/prophet

Hi Team,

First and foremost thank you for this library! It has been really simple to use and very easy to understand.

I'm not sure if this is the right place to post this, but how would I add additional parameters to the model? For example, if I'm trying to forecast metrics related to user behaviour, I would like to include details such as their age groups, gender, etc. into the model. Would the current Stan model implementation have to be modified to accommodate these changes? If yes, could you point me to some resources that show how these models can be modified to add demographic information?

Thanks!

Most helpful comment

Hi @sophia-wright-blue ,

Yes, I did get a chance to try this out! Fortunately, the results were good enough to be accepted. Adding the top-level model as a regressor worked for segments that had very little data. To understand more about how Empirical Bayes Shrinkage works, I used this blog as a reference.

All 9 comments

My initial impression is that there won't be an easy way to do what you're trying to do, but I'm a little unclear on the details.

How are demographic information meant to be incorporated into the forecast? Is it the case that you have a separate time series for each of these demographic buckets and want to jointly forecast them all? And/or model the effect of these demographic features on the time series?

Hi @bletham,

Thanks for your response! As you mentioned, I would like to model the effect of these demographic features on the time series forecast.

This is related to #49 on multivariate modeling.

Basically, there isn't built-in functionality for jointly forecasting multiple time series. Modifying the Stan to do this would not be easy because the model is defined both in the Stan and in the R/Py (since it is fit in Stan, but predictions are made in R/Py). So you'd have to make changes in both places and I expect this would end up being a big refactor and easier to just do from scratch.

However, for this particular problem of forecasting demographic subgroups, there is something you can try which I describe in a comment here: https://github.com/facebook/prophet/issues/49#issuecomment-430383681

Basically, you can make a forecast for the top-level aggregate, and then when forecasting each demographic bucket include the top-level forecast as an extra regressor. This can improve your bucket forecasts by doing something like an Empirical Bayes shrinkage, and can also quantify the relationship between the bucket and the aggregate by looking at the regressor component.

Hi @bletham ,

Ah yes this is interesting. It makes sense. I will try this out and let you know about my results. Thanks!

hello @goodhamgupta , I was looking to do something similar to what you've described here, did you get a chance to try out the suggestion above to model the effect of demographic forecasts on the time series forecast? thanks,

Hi @sophia-wright-blue ,

Yes, I did get a chance to try this out! Fortunately, the results were good enough to be accepted. Adding the top-level model as a regressor worked for segments that had very little data. To understand more about how Empirical Bayes Shrinkage works, I used this blog as a reference.

Hi @sophia-wright-blue

I've updated the link. It should work now. Thanks!

Hi @goodhamgupta
I'm also looking to do something similar to what you've described here. I'm new to this. I don't understand how to 'make the forecast as a top-level model' and 'Adding the top-level model as a regressor when modeling the effect of other features on the time series data'. My question may be silly. Could you please explain it in detail? If you could give some code example, it will be more helpful. Thanks!

Hell Na-Yin, did you get this to work ?

Was this page helpful?
0 / 5 - 0 ratings