Prophet: Holiday Effects for Sub-Daily data

Created on 12 Jul 2019  路  2Comments  路  Source: facebook/prophet

Hello, I have hourly data with daily seasonality. How would one go about including holiday effects like Christmas day? There is a marked increase in value on holidays like Christmas.

Most helpful comment

If the holiday is specified with the usual holidays interface, then it will add a constant offset for the entire day. I imagine for hourly data you probably have some shape other than constant to the actual holiday effect. If you want to allow the holiday effect on Christmas to have a generic shape (like daily seasonality), then you can use a masked seasonality. Basically what you will do is define a "ChristmasSeasonality" that is a daily seasonality but only for Christmas. See the documentation here: https://facebook.github.io/prophet/docs/seasonality,_holiday_effects,_and_regressors.html#seasonalities-that-depend-on-other-factors

It would look like

m.add_seasonality(
    name='ChristmasSeasonality',
    period=1,  # 1-day period
    fourier_order=4,  # This is the default for the built-in daily seasonality
    condition_name='is_Christmas',
)

and you would add a binary column to your history and future dataframes that is 0 if the ds is not on Christmas, and 1 if it is on Christmas.

All 2 comments

If the holiday is specified with the usual holidays interface, then it will add a constant offset for the entire day. I imagine for hourly data you probably have some shape other than constant to the actual holiday effect. If you want to allow the holiday effect on Christmas to have a generic shape (like daily seasonality), then you can use a masked seasonality. Basically what you will do is define a "ChristmasSeasonality" that is a daily seasonality but only for Christmas. See the documentation here: https://facebook.github.io/prophet/docs/seasonality,_holiday_effects,_and_regressors.html#seasonalities-that-depend-on-other-factors

It would look like

m.add_seasonality(
    name='ChristmasSeasonality',
    period=1,  # 1-day period
    fourier_order=4,  # This is the default for the built-in daily seasonality
    condition_name='is_Christmas',
)

and you would add a binary column to your history and future dataframes that is 0 if the ds is not on Christmas, and 1 if it is on Christmas.

When you generate the components plot, it will have a panel for the ChristmasSeasonality that will show the effect applied to every Christmas.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xiaoyaoyang picture xiaoyaoyang  路  3Comments

ahash52 picture ahash52  路  3Comments

teramonagi picture teramonagi  路  3Comments

dsvrsec picture dsvrsec  路  3Comments

ChaymaeHarfoush picture ChaymaeHarfoush  路  3Comments