-
Notifications
You must be signed in to change notification settings - Fork 230
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
Out-of-Box MultiDimensional MMM #1036
base: main
Are you sure you want to change the base?
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1036 +/- ##
==========================================
- Coverage 94.61% 90.58% -4.03%
==========================================
Files 50 51 +1
Lines 5441 5694 +253
==========================================
+ Hits 5148 5158 +10
- Misses 293 536 +243 ☔ View full report in Codecov by Sentry. |
@cetagostini I've been experimenting with this new feature and came across a potential bug. When trying to use partial pulling across a geo dim, I am running into a broadcasting error. Looking like its throwing that error when creating the
However, modifying that to include the dims being passed to the
fixes the broadcasting error and I was able to fit the model from there. Here's the full traceback - @wd60622
|
Good catch @tim-mcwilliams @cetagostini You can do checks on the dims in the priors at initialization in order to catch errors earlier if needed |
@wd60622 thanks! Correct, with the fix I was able to get the model working. |
"Normal", sigma=Prior("HalfNormal", sigma=2), dims=self.dims | ||
), | ||
"gamma_control": Prior("Normal", mu=0, sigma=2, dims="control"), | ||
"gamma_fourier": Prior("Laplace", mu=0, b=1, dims="fourier_mode"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding *self.dims
to gamma_fourier
should enable the modeler to capture seasonality at each dim they specifiy. For example, dims=(*self.dims, "fourier_mode")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, this makes the dims for the media match seasonality. The user can always specify with the model config.
Therefore, I lean away from this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wd60622 yea, good point there! Best to leave the default config be.
hi guys, this looks really good and useful! Thanks for pointing me here, @cetagostini I've read the example notebook and I have some questions:
|
Hey @luiztauffer Not exactly. Running 4 separate MMMs treats each dimension (e.g., country or channel) as independent, with no shared parameters or assumptions. VanillaMultiDimensionalMMM (Currently only MMM class) uses a unified probabilistic framework where all dimensions (e.g., country, channel) are modeled together within a single Bayesian model. While it may seem like separate models are being trained because results are reported or analyzed per dimension, these dimensions are interdependent. For example:
So, while the output may look dimension-specific (e.g., country-level or channel-level effects), the model leverages cross-dimensional information during training 🙌🏻 |
@wd60622 feel free to jump if you want. Play around today and get a head start on the API, for now we are able to properly train a mmm with all the features of the current MMM class. Basically we have TVPs and hierarchical structures, with the possibility of being multi-dimensional. On the other hand, scaling occurs within the model, avoiding the need to scale inputs in plots or outputs in the model, everything is ready to use, reducing functions like
|
Can you give me a hand rescaling the sigma? Because its |
Description
Creating an API to support multiple dims.
Related Issue
Checklist
Modules affected
Type of change
📚 Documentation preview 📚: https://pymc-marketing--1036.org.readthedocs.build/en/1036/