Prophet: How to specify positive multiplicative holiday effect with increasing growth rate?

Created on 11 Jul 2019  Â·  3Comments  Â·  Source: facebook/prophet

From the documentation, It looks like holiday will be multiplicative if seasonality_mode='multiplicative', no need to log transform!
1, Can we force holiday to be positive effects, Ideally it would be a date range, and for all date within that range, applying multiplicative factors...? (e.g. for modeling promotion & sales)
2, For holiday & seasonality, right now I think the model learn a fixed rate/value. In this case, How to handle if the seasonality / holiday effect grow over time? (and the grow rate is not proportional to the trend, otherwise I would image multiplicative/log transform would work)
3, Is there a way to penalize the cost function, so that we could force the model to overestimate/underestimate the data?

Thanks a lot!

Most helpful comment

If you use the lower and upper windows, then under the hood it is actually creating separate holidays for each day in the window. So, Christmas with upper_window=2 will create 3 holidays: Christmas, Christmas+1, and Christmas+2. Each of these will have its own effect size fit, so it will be able to capture that the effect is decreasing as we get away from the holiday. For instance, if you look at the first table in the holidays documentation (https://facebook.github.io/prophet/docs/seasonality,_holiday_effects,_and_regressors.html#modeling-holidays-and-special-events), you can see that the "Playoff" holiday has a value of 1.217571 on the date specified as a playoff game, and an effect of 1.898042 on the day after the playoff.

Specifying a holiday is equivalent to creating a binary extra regressor that is 1 on the dates of the holiday and 0 otherwise. Using upper and lower window parameters is equivalent to creating a separate binary extra regressor for each offset in the window.

As for other transforms, I don't have any personal experience trying that but I'd be interested to hear if you learn anything from trying!

All 3 comments

  1. No, the sign of the holiday effect will be fit to the data and cannot be forced to be positive. But it would only fit a negative effect if there were consistent drops in the data, so I don't have a really clear sense of why one would need to impose such a constraint.

  2. That is correct; with multiplicative seasonality, the assumption is that the effect of the holiday is a constant % of the trend. If that % is changing over time, there isn't any way right now to capture that. Unless you know the rate of change per year then you could use an extra regressor, but otherwise Prophet will do something like fit the average effect across time.

  3. Not built-in. The cost function is log-likelihood of a Normal distribution (plus some penalties for priors) and so is symmetric wrt the sign of the error:
    https://github.com/facebook/prophet/blob/480b67b8fed05381b910bce6e7a64efba9f0d838/python/stan/unix/prophet.stan#L117
    To prefer over/under estimation that would have to be swapped out for a different distribution that isn't symmetric. I suppose as a workaround you could try transforming the data. For instance a log transform would compress points above the mean more than points below the mean and I'd expect to thus bias towards under predicting.

@bletham Thanks a lot for timely reply!
1, The use case is exactly like sales promotions, where we almost 100% sure the effect will be positive, and I am trying to model the effect not only on a single date, but also including days after the holiday, where the effect of holiday will decrease over time.

It seems that one type of holiday will apply a fixed rate (multiplicative), across all dates, all lower and upper windows specified..?

The walkaround I can think of is to create couple holiday like: holiday, 1 day after holiday, 2 day after holiday etc..I came up with this question due to a mistake I made... I specified window of the holiday too wide and I think that prevent the model from learning the right effect..

Question: is the Holiday similar to the extra regressors in terms of model fitting? They seems to be similar when predicting. And I am trying to use extra regressors to simulate Holiday effect decrease over time

2, Agree..

3, The transformation idea is awesome! I will give it a try.. could you also give us a hint regarding what functions might be a good candidate for biasing towards over predicting..? maybe X^2:)?

If you use the lower and upper windows, then under the hood it is actually creating separate holidays for each day in the window. So, Christmas with upper_window=2 will create 3 holidays: Christmas, Christmas+1, and Christmas+2. Each of these will have its own effect size fit, so it will be able to capture that the effect is decreasing as we get away from the holiday. For instance, if you look at the first table in the holidays documentation (https://facebook.github.io/prophet/docs/seasonality,_holiday_effects,_and_regressors.html#modeling-holidays-and-special-events), you can see that the "Playoff" holiday has a value of 1.217571 on the date specified as a playoff game, and an effect of 1.898042 on the day after the playoff.

Specifying a holiday is equivalent to creating a binary extra regressor that is 1 on the dates of the holiday and 0 otherwise. Using upper and lower window parameters is equivalent to creating a separate binary extra regressor for each offset in the window.

As for other transforms, I don't have any personal experience trying that but I'd be interested to hear if you learn anything from trying!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gentnm picture gentnm  Â·  3Comments

andmib picture andmib  Â·  3Comments

maxwell873 picture maxwell873  Â·  3Comments

teramonagi picture teramonagi  Â·  3Comments

andrew-pollock picture andrew-pollock  Â·  3Comments