Fix funnel MuEffect footguns: namespaced data vars and channel-by-name API - #2907
Fix funnel MuEffect footguns: namespaced data vars and channel-by-name API#2907drbenvincent wants to merge 3 commits into
Conversation
…e API Prefix DataVarMuEffect pm.Data registration with the effect prefix and add MMM.scaled_channel so funnel notebooks can select treatment spend by name instead of positional index. Closes #2871 Co-authored-by: Cursor <cursoragent@cursor.com>
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2907 +/- ##
===========================================
- Coverage 94.84% 71.70% -23.14%
===========================================
Files 110 110
Lines 17389 17398 +9
===========================================
- Hits 16492 12476 -4016
- Misses 897 4922 +4025 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: Cursor <cursoragent@cursor.com>
Review round 1 (Bugbot + manual)BugbotNo bugs flagged on branch diff. Manual review notesBreaking change (intentional, closes #2871)
Coverage added in follow-up commit
Out of scope / follow-ups
Round 1 fixes pushed
|
|
thanks @drbenvincent ! This is great! Can you please take a look into the failing notebook test :) ? |
| for var_name in self.data_vars: | ||
| da = mmm.xarray_dataset[var_name] | ||
| pmd.Data(var_name, da.values, dims=da.dims) | ||
| pmd.Data(self.model_data_name(var_name), da.values, dims=da.dims) |
There was a problem hiding this comment.
If it is actually the same data, dont think we want differnet nodes in the graph
Summary
DataVarMuEffectpm.Dataregistration as{prefix}_{var_name}so multiple effects can share dataset column names without build-time collisionsMMM.scaled_channel(channel)to select scaled spend by channel name instead of a positional indexCloses #2871
Test plan
pytest tests/mmm/test_additive_effect.py::TestDataVarMuEffectpytest tests/mmm/test_mmm.py::TestMultidimMMMEdgeCases::test_scaled_channel_selects_by_namepytest tests/mmm/test_incrementality.py::TestPostFitMutationGuardpytest tests/mmm/test_incrementality.py::TestMediatedMuEffects::test_evaluator_discovers_the_effect_s_own_datapytest tests/mmm/test_additive_effect.py -k "MediaMu or ControlMu"Made with Cursor
📚 Documentation preview 📚: https://pymc-marketing--2907.org.readthedocs.build/en/2907/