-
Notifications
You must be signed in to change notification settings - Fork 244
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
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 94.57% 94.52% -0.06%
==========================================
Files 49 50 +1
Lines 5330 5386 +56
==========================================
+ Hits 5041 5091 +50
- Misses 289 295 +6 ☔ View full report in Codecov by Sentry. |
I think the previous comments on the notebooks have not been addressed yet ;) |
Like, good catch! View entire conversation on ReviewNB |
Removed by mean plus noise instead of drop. View entire conversation on ReviewNB |
This will hold a bit by the adstock effects, always with the first points. View entire conversation on ReviewNB |
Yes, I explain about them later on in the text. View entire conversation on ReviewNB |
Got some latex issue when I tried, can you give me a hand? Maybe I did something wrong. View entire conversation on ReviewNB |
Done! View entire conversation on ReviewNB |
Replaced. View entire conversation on ReviewNB |
Done! View entire conversation on ReviewNB |
Must be x1t but maybe I'm running something wrong, can you give me the markdown to replace? Just the style, I can propagate. View entire conversation on ReviewNB |
@wd60622 it would be great to have another pair of eyes to review this cool PR ;) (if possible) |
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 additional code changes :)
The notebook looks 🚀 ! I think after the previous small code comments, we can merge this one (plus potential @wd60622 comments) |
Thank you @juanitorduz, I follow your comments! Hope everything is looking a bit better. |
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.
Looks good!
Can we provide a better PR name before the release. "Add Causal DAG support in MMM definition" or something
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/