-
Notifications
You must be signed in to change notification settings - Fork 201
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
Creating Causal Identification module #1166
base: main
Are you sure you want to change the base?
Conversation
What is |
Old example, I did the correction! |
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 #1166 +/- ##
==========================================
- Coverage 95.64% 95.37% -0.28%
==========================================
Files 39 40 +1
Lines 4089 4147 +58
==========================================
+ Hits 3911 3955 +44
- Misses 178 192 +14 ☔ View full report in Codecov by Sentry. |
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2024-11-17T18:02:02Z Did anything chane in the MMM example notebook? |
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2024-11-17T18:20:27Z Add subtitle like: business problem |
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2024-11-17T18:20:28Z Shall we remove the first data points which are generated by the natural fact that we can not adstock much for the initial point ? |
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2024-11-17T18:20:28Z Again, lets remove the first point because this initial jump is just artificial and looks odd. |
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2024-11-17T18:20:29Z Any idea on the divergences? |
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2024-11-17T18:20:30Z Can we use |
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2024-11-17T18:20:31Z Maybe we should display the HDI instead of the heat plots as we need to fix that the legend here is miningless (I will fix this soon) |
View / edit / reply to this conversation on ReviewNB juanitorduz commented on 2024-11-17T18:20:31Z Do we need to display these warnings? |
@carlosagostini I really liked the notebook 🚀 ! I think if we improve the level of abstraction (see comments above) and update the notebooks, we can merge this one soon! @drbenvincent It would be great if you could review the notebook to provide feedback if you have time 🙏 :) |
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.
Some comments and questions
Hey guys, the PR is good. But I reckon, I need a hand with the tests. @wd60622 @juanitorduz Happy if we can have a quick meeting to address them? |
Ready for final review @juanitorduz |
@cetagostini is the change in the MMM example relevant for this PR? I can't find a difference between the original and the change :) |
I need it to run to get a new |
Description
Short description: Integration of CausalGraphModel in BaseMMM Class
This update integrates a CausalGraphModel into the BaseMMM class, allowing for automated causal identification based on backdoor criteria, assuming a given Directed Acyclic Graph (DAG).
Summary of Changes
Added Causal Graph Option:
BaseMMM
class now accepts an optionaldag
parameter, which can be provided either as a string (DOT format) or anetworkx.DiGraph
.dag
is provided, aCausalGraphModel
is instantiated to analyze causal relationships and determine necessary adjustment sets.Automatic Minimal Adjustment Set Handling:
BaseMMM
initialization now includes logic to calculate the minimal adjustment set required to estimate the causal effect of the treatment variables (assume to be media channels) on the outcome.control_columns
are automatically updated to include variables from the minimal adjustment set only.yearly_seasonality
is not in the minimal adjustment set, theyearly_seasonality
parameter is set toNone
, effectively disabling it in the model.Warnings for Missing Adjustment Sets:
Code Example
Here's how to initialize
BaseMMM
with a DAG for causal inference:Related Issue
Checklist
Modules affected
Type of change
📚 Documentation preview 📚: https://pymc-marketing--1166.org.readthedocs.build/en/1166/