I have been using Prophet from Facebook and so far it has been produced some great results.
Having looked in the docs and googling, there doesn't seem to be an automatic way to extract the seasonal trends from a model as a dataframe or a dict, e.g.:
weekly_trends = { 1 : monday_trend, 2 : tuesday_trend, ... , 7 : sunday_trend }
yearly_trends = { 1 : day_1_trend, 2 : day_2_trend, ... , 365 : day_365_trend }
Currently I can extract these out using a more manual way but was just wondering if I had missed something more elegant?
Prophet will by default fit weekly and yearly seasonalities, if the time series is more than two cycles long. It will also fit daily seasonality for a sub-daily time series. You can add other seasonalities (monthly, quarterly, hourly) using the add_seasonality method (Python) or function (R).
Accurate and fast. Prophet is used in many applications across Facebook for producing reliable forecasts for planning and goal setting. We've found it to perform better than any other approach in the majority of cases.
Prophet is an additive regression model with a piecewise linear or logistic growth curve trend. It includes a yearly seasonal component modeled using Fourier series and a weekly seasonal component modeled using dummy variables. For more information, see Prophet: forecasting at scale .
Seasonality refers to predictable changes that occur over a one-year period in a business or economy based on the seasons including calendar or commercial seasons. Seasonality can be used to help analyze stocks and economic trends.
The trained model dataframe has all the seasonal, trend and holidays information. - take a look at its columns. Here's how to look into it in Python:
m = Prophet()
m.fit(ts)
future = m.make_future_dataframe()
forecast = m.predict(future)
print(forecast['weekly'])
Take any 7 days out of that series. That will give you the scale of the additive weekly adjustment for each weekday. Similar for the yearly seasonality.
You can specify daily, weekly, and yearly seasonality during model fit
m = Prophet(changepoint_prior_scale=0.01, weekly_seasonality=False, holidays=holidays, interval_width=0.90, yearly_seasonality=True, mcmc_samples=300)
m.add_seasonality(name='weekly', period=7, fourier_order=3)
m.add_seasonality(name='monthly', period=30.5, fourier_order=8)
m.fit(X)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With