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

Refactor Saturation components for consistency #1348

Open
ulfaslak opened this issue Jan 6, 2025 · 3 comments
Open

Refactor Saturation components for consistency #1348

ulfaslak opened this issue Jan 6, 2025 · 3 comments
Labels
media transforms Related to adstock, saturation, and media transformations MMM

Comments

@ulfaslak
Copy link
Contributor

ulfaslak commented Jan 6, 2025

As a tangent to the discussion around #1303, I realize there's inconsistency among the saturation components (the SaturationTransformation children in mmm.components.saturation), some even amounting to genuine bugs. It appears that we are sometimes multiplying a coefficient beta with the saturation function in all function methods. For some saturation functions this is meaningful (see said discussion in #1303), but for others it is not.

For example, in TanhSaturationBaselined.function, beta has the same role as gain, and so enters twice which it should not. This is an error.

In MichaelisMentenSaturation.function, beta is not multiplied into the inner saturation function.

I suggest we refactor the saturation functions (inside mmm.transformers) so they either:

  • consistently map between spend and saturated spend, or
  • consistently map between spend and response (revenue, signups, or whatever the KPI might be)

The first option is probably easiest, since that's what most of the functions currently do. The second may be best because then we can put a nice docstring in the mmm.transformers saturation functions explaining what beta is. But they they should all be renamed from ...saturation... to ...response... IMO (see related #1349 for argument).

@ulfaslak ulfaslak changed the title Refactor Saturation components for consistency (and possibly rename to Response components) Refactor Saturation components for consistency Jan 6, 2025
@ulfaslak ulfaslak added media transforms Related to adstock, saturation, and media transformations and removed Needs Triage labels Jan 6, 2025
@wd60622 wd60622 added the MMM label Jan 6, 2025
@wd60622
Copy link
Contributor

wd60622 commented Jan 6, 2025

Understand a bit better now and need to look over a bit more. Yeah, I agree the response vs saturation. The spend to response decision came from menten acting that way. Alpha of menten could be pulled out making it more similar to the others and then "saturation" might more sense. All of them should at the moment should go from spend to response, including a mulitplier (usually but not always named beta), but there may have been an incorrect implimentation

Am I interpreting this the correctly? Do we have a list of SaturationTransformer child class that dont fit this bill?

@wd60622
Copy link
Contributor

wd60622 commented Jan 7, 2025

I dont understand how this is different from #1349

@ulfaslak
Copy link
Contributor Author

ulfaslak commented Jan 7, 2025

Alpha of menten could be pulled out making it more similar to the others and then "saturation" might more sense.

Yes you have fully understood my point.

I dont understand how this is different from #1349

No I guess the nuance is subtle, but I just wouldn't do any name changes in the PR that resolves this issue, since that might trigger changes to tests etc, and so not to bloat the resulting PRs, it's just nice to keep the "consistency refactor" and the "name change" separate.

Maybe dumb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
media transforms Related to adstock, saturation, and media transformations MMM
Projects
None yet
Development

No branches or pull requests

2 participants