Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

positivity constraint on season not respected #341

Closed
drbenvincent opened this issue Mar 13, 2022 · 5 comments
Closed

positivity constraint on season not respected #341

drbenvincent opened this issue Mar 13, 2022 · 5 comments
Assignees
Labels

Comments

@drbenvincent
Copy link

I am running a model with the following options

prophet_vars = c("trend", "season", "holiday"),
prophet_signs = c("positive", "positive", "positive"),

but when I examine pareto_alldecomp_matrix.csv (and just focus on a particular model of interest) then I see both positive and negative values. The positivity constraint does not seem to be applied.

I'd be grateful if you could confirm that this is a bug. If it is, I'd be even more grateful if it could be fixed.

Environment & Robyn version

R version 4.0.4
Robyn version 3.6.1 (installed by remotes::install_github('facebookexperimental/Robyn/R'))

@laresbernardo
Copy link
Collaborator

Checking the code, I don't see any obvious error or bug. I'll further run a hypothetical check without your data to reproduce this scenario first before I get back to you.. thanks for reporting it.

@laresbernardo laresbernardo self-assigned this Mar 14, 2022
@laresbernardo
Copy link
Collaborator

Hey @drbenvincent
We've internally discussed this specific case you mention and actually find it quite relevant. We think this is probably one of those very rare cases where it should probably be something only advanced users do and we generally try to discourage, given that forcing a sign for season/holiday logically may not make much sense in most scenarios.
I'd also like to share with you this ticket where prophet's team discusses this matter with great detail and some illustrated examples.
CC: @Leonelsentana @kyletgoldberg

@drbenvincent
Copy link
Author

Thanks for that link @laresbernardo. I'll work through that - it looks to touch on issues I've been thinking about.

Just a bit more on the motivation... I'm trying to produce a contribution plot, as in a stacked area plot over time which decomposes the total predicted outcome variable over time into its various component parts. You could argue that (regardless of the implementation details) it would be appealing (and should be possible) to plot the contributions over time from each channel, intercept, trend, seasonality, etc.

So I'm a little uncertain at the moment if there is a working positivity constraint or not?
But given that the seasonality component is producing positive and negative numbers that it's additive (not multiplicative). If so, I guess you might get positive only contributions from intercept+seasonality.

Either way, it should be possible to find the maths of the seasonality implementation (presumably in Prophet) that would allow generation of a contribution plot over time from the fitted parameters from Robyn.

@DzimitryM
Copy link

I observe the same issue.
Training the model with the "positive" constrains to all prophet variables results in negative effects at the decomposition waterfall. Some models have negative season effect, some models have negative effect of holidays and weekday.

Robyn 3.6.3

@gufengzhou
Copy link
Contributor

Please reopen if this issue reoccurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants