Prophet: Time series decomposition using prophet

Created on 26 Feb 2019  路  6Comments  路  Source: facebook/prophet

Hi Devs,

I have a use case of decomposing a time series using the prophet. I know that internally prophet decomposes the time series into seasonal, trend and holiday components. But I couldn't find a way to extract the components of a fitted prophet model ( You can achieve this in the famous forecast package, by invoking the tbats.components(model), once a tbats model is being fitted, assuming you are fitting a tbats model)

The only available API in the prophet package is the prophet_plot_components(), which only provides the component decomposition of the predicted values. Following is an excerpt of my code, which I use to extract the components of the predicted values.

m <- prophet(history)
forecast_prophet <- predict(m,future)
forecast_prophet$daily
forecast_prophet$weekly
forecast_prophet$trend

Is there any API available in prophet to extract the components in a fitted model of Prophet, which is m in this case?

Thanks in advance.
Kasun.

All 6 comments

I'm not exactly sure what you mean. As you noted, you can evaluate the components on any set of dates by calling predict. What is the functionality that you are looking for?

Hi @bletham,

Many thanks for your reply. I want to decompose the original time series into seasonal and trend components (time series decomposition of a given time series). Is there any API in Prophet to achieve this? predict function only shows the components of the predicted values, not the original time series that is being used to forecast. I hope you understand my question.

Regards,
Kasun.

Ah, I see. If you call predict() without passing in a dataframe, then it will make a "prediction" on the history, which sounds like what you're looking for.

Hi @bletham,

Thanks again. Yes, just calling the prediction function passing the model did the work.

Also, would you mind if I ask another small query here? My question is whether Prophet supports sub-hourly time series (e.g. half-hourly) forecasting?. This is because, in the API, I didn't observe any parameter to set the hourly. seasonality = TRUE

Thanks in advance.

Regards,
Kasun.

Yes, there's actually an example in the documentation with a time series with 5 minute intervals: https://facebook.github.io/prophet/docs/non-daily_data.html#sub-daily-data

"daily" seasonality means a periodic cycle that lasts one day, which is useful for sub-daily data. If there are cycles that are faster than that in your time series, you could specify them as custom seasonalities as described here: https://facebook.github.io/prophet/docs/seasonality,_holiday_effects,_and_regressors.html#specifying-custom-seasonalities

Hi @bletham,

This is exactly I was looking for. Many thanks for providing these resources and appreciate your help.

Regards,
Kasun.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andmib picture andmib  路  3Comments

germayneng picture germayneng  路  3Comments

datafool picture datafool  路  3Comments

robertdknight picture robertdknight  路  3Comments

teramonagi picture teramonagi  路  3Comments