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

Optional Negative Values in MMM Channels #915

Closed
louismagowan opened this issue Aug 6, 2024 · 2 comments · Fixed by #1092
Closed

Optional Negative Values in MMM Channels #915

louismagowan opened this issue Aug 6, 2024 · 2 comments · Fixed by #1092
Labels
duplicate This issue or pull request already exists MMM

Comments

@louismagowan
Copy link
Contributor

Currently the MMM by default informs our channels to be >=0 via the HalfNormal and inclusion of only non-negative values (see ValidateChannelColumns.

However, the opposite could be true for certain variables. For example, you might believe that the amount your competitors are spending on your Brand keywords in Search Engine Advertising could only have a negative or 0 effect on your target metric.

It would be nice to have an option to pass in a column of negative values, such that the effect of that channel is negative overall (since we don't need to change from the default HalfNormal prior, we can just multiply).

It could look something like this

mmm = MMM(
    date_column="date",
    channel_columns=["facebook", "google", "competitor",...],
    control_columns=["control_1", "control_2"]
    allow_negative_columns=["competitor"]
    adstock=my_adstock,
    saturation=my_saturation,
    adstock_max_lag=4,
)

I think it should be straightforward to extend ValidateChannelColumns to allow for negative columns.

I'm happy to work on this PR, perhaps with Ruari from Qonto too 😁

@wd60622
Copy link
Contributor

wd60622 commented Aug 6, 2024

Can you negate the controls in the DataFrame and use validate_data = False? Does that work?

Are you able to check that this works @louismagowan

Same as #413

@wd60622 wd60622 added the MMM label Aug 6, 2024
@wd60622 wd60622 added the duplicate This issue or pull request already exists label Aug 15, 2024
@louismagowan
Copy link
Contributor Author

Hey @wd60622 your tip works, thanks! I still think it might be nice behaviour to let users select certain columns not to validate, or pass as negative etc rather than a blanket validate all vs validate none.

^If nobody takes this, I'd still be interested in doing this at some point ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists MMM
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants