linkedin / greykite

A flexible, intuitive and fast forecasting library
BSD 2-Clause "Simplified" License
1.81k stars 105 forks source link

Extract components from forecast #62

Open Jonathan-MW opened 3 years ago

Jonathan-MW commented 3 years ago

Hi, I was wondering if it is possible to extract the different modeling components (e.g. trend, holidays, seasonalities) from the forecasted time series. It's possible to do this in the Prophet framework, see: https://github.com/facebook/prophet/issues/1920

The reason is that I would like to use a custom trend component calculated outside of Greykite.

Reza1317 commented 3 years ago

Hi,

It is within our plans to add that most likely in the next release. Please stay tuned.

Thanks.

dromare commented 2 years ago

Hi @Jonathan-MW,

I believe this was answered by @sayanpatra in issue #44. I am trying it and it seems to work, the only change I had to make was to rename my time column to "ts" in the following line: fut_df = result.forecast.df[["ts", "actual"]].rename(columns={"actual":"y"})

samuelefiorini commented 2 years ago

Hi, any update on this feature?

I tried the solution proposed in #44 but, I couldn't figure out a way to include external regressors as well.

Reza1317 commented 2 years ago

Hi,

We have an update for this. Now you can get custom / flexible breakdowns as per your need from the model both for fitted and predicted values. We call them forecast breakdowns. See documentation here: https://linkedin.github.io/greykite/docs/0.4.0/html/gallery/quickstart/02_interpretability/0200_interpretability.html

Note that this will enable you to define the breakdown as desired by various grouping. The existing "component plots" are still being returned by the model but they are not as flexible and do not apply for predicted values. They are meant to give some idea about what the model doing. We might merge the two methods in next releases. But for now I recommend using the above documentation to get exactly what you desire using "forecast breakdowns".