Add default PyMC models when model=None for all experiment classes#707
Add default PyMC models when model=None for all experiment classes#707ErikRingen wants to merge 2 commits intomainfrom
Conversation
Closes #661. Experiment docstrings claimed default models would be used when model was omitted, but BaseExperiment immediately raised ValueError. - Add _default_model_class class attribute to BaseExperiment with fallback logic that instantiates the default when model is None - Set appropriate defaults on all 9 experiment subclasses: LinearRegression for most, WeightedSumFitter for SyntheticControl, InstrumentalVariableRegression for IV, PropensityScore for IPW - Fix incorrect type hints (BaseExperiment -> PyMCModel) in IV, IPW, and RegressionKink - Remove redundant self.model = model in InstrumentalVariable that would have overwritten the default - Add parametrized integration tests for all 9 experiment classes Co-authored-by: Cursor <cursoragent@cursor.com>
PR SummaryMedium Risk Overview All affected experiments set Written by Cursor Bugbot for commit e38fa9e. This will update automatically on new commits. Configure here. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #707 +/- ##
==========================================
+ Coverage 94.36% 94.40% +0.04%
==========================================
Files 44 45 +1
Lines 7591 7646 +55
Branches 461 463 +2
==========================================
+ Hits 7163 7218 +55
Misses 264 264
Partials 164 164 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Closes #661.
Experiment docstrings claimed default PyMC models would be used when
modelwas omitted, butBaseExperimentimmediately raisedValueError("model not set or passed."). This aligns actual behavior with the documented API._default_model_classclass attribute toBaseExperimentwith fallback logic that instantiates the default whenmodel is NoneLinearRegressionfor most,WeightedSumFitterforSyntheticControl,InstrumentalVariableRegressionforInstrumentalVariable,PropensityScoreforInversePropensityWeightingBaseExperiment->PyMCModel) inInstrumentalVariable,InversePropensityWeighting, andRegressionKinkself.model = modelinInstrumentalVariablethat would have overwritten the default set bysuper().__init__()Test plan
model=Nonetest_model_experiment_compatabilitytests pass (OLS rejection still works)Made with Cursor