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

geometric adstock optimization #1289

Open
wd60622 opened this issue Dec 17, 2024 · 0 comments
Open

geometric adstock optimization #1289

wd60622 opened this issue Dec 17, 2024 · 0 comments
Labels
enhancement New feature or request media transforms Related to adstock, saturation, and media transformations MMM

Comments

@wd60622
Copy link
Contributor

wd60622 commented Dec 17, 2024

Code snippet from @aseyboldt which uses pytensor.scan to implement the geometric adstock. This doesn't require l_max

delay = pm.Gamma("delay", mu=5, sigma=2, dims="channel")

    def convolve_step(val, prev, delays):
        return val / delay + prev * (1 - 1 / delay)

    prev_zero = spending.T[0]
    
    convolved, _ = pytensor.scan(
        convolve_step,
        sequences=[spending.T],
        outputs_info=[dict(initial=spending.T[0], taps=[-1])],
        non_sequences=delay,
    )

Would have to be adapted to support arbitrary dimensions and map into GeometricAdstock class formulation

@wd60622 wd60622 added enhancement New feature or request MMM and removed Needs Triage labels Dec 17, 2024
@wd60622 wd60622 added the media transforms Related to adstock, saturation, and media transformations label Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request media transforms Related to adstock, saturation, and media transformations MMM
Projects
None yet
Development

No branches or pull requests

1 participant