fix(mmm): allow constant tensors in adstock sample_prior (fixes #1749)#2304
fix(mmm): allow constant tensors in adstock sample_prior (fixes #1749)#2304shivamlalakiya wants to merge 4 commits intopymc-labs:mainfrom
Conversation
PR SummaryLow Risk Overview Adds regression tests for issue #1749 verifying Written by Cursor Bugbot for commit c940cf4. This will update automatically on new commits. Configure here. |
|
There's not really any prior being sampled... |
Description
Fixes #1749
Previously,
sample_priorwould fail if an adstock transformation (e.g.,GeometricAdstock) was initialized with constant tensors instead of PyMC distributions, aspm.sample_prior_predictiverequires free random variables.This PR adds a fallback mechanism: if no free random variables are detected in the model, it evaluates the constant tensors deterministically and returns a valid
InferenceDataobject.Changes
sample_priorintransformers.pyto handleValueErrorfromsample_prior_predictive.tests/mmm/test_issue_1749.pyto verify constant inputs work.Related Issue
Checklist
pre-commit.ci autofixto auto-fix.📚 Documentation preview 📚: https://pymc-marketing--2304.org.readthedocs.build/en/2304/