Add ExperimentDesigner: posterior-aware experiment design for lift tests#2356
Draft
drbenvincent wants to merge 9 commits intomainfrom
Draft
Add ExperimentDesigner: posterior-aware experiment design for lift tests#2356drbenvincent wants to merge 9 commits intomainfrom
drbenvincent wants to merge 9 commits intomainfrom
Conversation
Implements a posterior-aware experiment designer that recommends which marketing experiment to run based on a fitted MMM's uncertainty about channel response functions. Computes adstock-aware lift predictions, Bayesian assurance (posterior-predictive power), and weighted composite scores across candidate experiments. Includes ExperimentDesigner class with recommend() and 5 plotting methods, ExperimentRecommendation dataclass, numpy response functions, fixture generator, and 65 tests. Closes #2355 Made-with: Cursor
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2356 +/- ##
==========================================
- Coverage 93.15% 92.70% -0.46%
==========================================
Files 79 83 +4
Lines 12523 13112 +589
==========================================
+ Hits 11666 12155 +489
- Misses 857 957 +100 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Add end-to-end walkthrough notebook (docs/source/notebooks/mmm/) - Add gallery entry under "Experiment Design" section - Ship pre-built InferenceData fixture (simulated_3channel.nc) - Add slow simulation-based assurance calibration tests - Add tests for scoring weight redistribution and channel ranking - Register 'slow' pytest marker in pyproject.toml Made-with: Cursor
Made-with: Cursor
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
…ansformer Eliminate experiment_design/functions.py by delegating to pymc_marketing.mmm.transformers.logistic_saturation via a new _eval_saturation() static method that calls .eval() on the PyTensor result. Made-with: Cursor
…c-labs/pymc-marketing into fix/2355-experiment-designer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ExperimentDesignerclass that recommends which marketing experiment to run (channel, spend level, duration) based on a fitted MMM's posterior uncertainty about channel response functionsDetails
Core computation: For each candidate experiment design (channel × spend change × duration), evaluates the posterior-predicted lift accounting for geometric adstock ramp-up, computes measurement noise σ = σ_residual · √T, and derives Bayesian assurance (expected power over the posterior distribution of the true effect).
Scoring dimensions: Channels are ranked by a configurable weighted sum of: posterior uncertainty, spend correlation, saturation gradient, assurance, and cost efficiency — all min-max normalised.
v1 scope: National-level experiments with
LogisticSaturation+GeometricAdstock(adstock_first=True). Geo-level designs, pulse/switchback experiments, and Fisher Information are deferred to v2.New files
pymc_marketing/mmm/experiment_design/designer.py—ExperimentDesignerclasspymc_marketing/mmm/experiment_design/recommendation.py—ExperimentRecommendationdataclasspymc_marketing/mmm/experiment_design/functions.py— Numpylogistic_saturationpymc_marketing/mmm/experiment_design/fixture.py—generate_experiment_fixture()Test plan
Closes #2355
Made with Cursor
📚 Documentation preview 📚: https://pymc-marketing--2356.org.readthedocs.build/en/2356/