Remove deprecated design-matrix alias shims (follow-up to #849)#958
Draft
drbenvincent wants to merge 8 commits into
Draft
Remove deprecated design-matrix alias shims (follow-up to #849)#958drbenvincent wants to merge 8 commits into
drbenvincent wants to merge 8 commits into
Conversation
Add _predictor_data_name and _target_data_name class attributes to PyMCModel so subclasses using non-default data node names can customize without re-implementing _data_setter. Validate at predict time and raise a clear ValueError if expected nodes are missing. Also fix pre-existing mypy type: ignore codes in panel_regression.py (attr-defined -> union-attr). Made-with: Cursor
Remove _predictor_data_name / _target_data_name class attributes (added complexity for a case no existing subclass needs). Keep the validation that raises a clear ValueError when expected data nodes are missing. Revert undeclared y_dtype behavioral change. Improve test coverage with separate X-missing and y-missing error paths. Made-with: Cursor
Bundle loose xr.DataArray attributes on experiment classes into xr.Dataset objects to reduce attribute sprawl. Pre/post classes (ITS, SC) use pre_design/post_design; formula-based classes use a single design Dataset. Deprecated @Property accessors preserve backward compatibility. Closes #199. Made-with: Cursor
Move _build_design_dataset helper and __getattr__ deprecation forwarding into BaseExperiment, replacing per-class @Property blocks with a declarative _deprecated_design_aliases dict. Fix convex_hull.py and maketables_adapters.py to use the new API directly. Add parametrized backward-compatibility tests covering all deprecated aliases. Made-with: Cursor
…y-datasets Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # causalpy/experiments/base.py # causalpy/experiments/diff_in_diff.py # causalpy/experiments/panel_regression.py # causalpy/experiments/piecewise_its.py # causalpy/pymc_models.py
- Migrate SyntheticDifferenceInDifferences (added on main in #823) to the pre_design/post_design Dataset pattern with deprecated aliases, matching SyntheticControl, and extend the alias test suite to cover it. - Normalize convex-hull call sites on xarray inputs and document that check_convex_hull_violation accepts numpy or xarray. - Replace type: ignore escape hatches in ConvexHullCheck.run with an isinstance assertion that narrows the type for mypy. - Point users at BayesianBasisExpansionTimeSeries in the _data_setter error message. Co-authored-by: Cursor <cursoragent@cursor.com>
Removes the BaseExperiment.__getattr__ deprecation forwarding, the per-class _deprecated_design_aliases mappings, and the backward-compatibility test suite introduced in #849. After this lands, the old attribute names (X, y, pre_X, pre_y, post_X, post_y, datapre_control, datapre_treated, datapost_control, datapost_treated) raise AttributeError; use design[...], pre_design[...] and post_design[...] instead. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #958 +/- ##
==========================================
- Coverage 95.14% 95.13% -0.01%
==========================================
Files 92 92
Lines 14860 14938 +78
Branches 890 895 +5
==========================================
+ Hits 14138 14212 +74
- Misses 505 507 +2
- Partials 217 219 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3 tasks
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
BaseExperiment.__getattr__deprecation forwarding, the declarative_deprecated_design_aliasesmappings on each experiment class, and thetest_deprecated_design_aliases.pycompatibility test suite.X,y,pre_X,pre_y,post_X,post_y,datapre_control,datapre_treated,datapost_control,datapost_treated) raiseAttributeErroron the migrated experiment classes; usedesign[...],pre_design[...]andpost_design[...]instead.Do not merge until
DeprecationWarnings in place, giving downstream users a migration windowTest plan
prek run --all-filespassesiv_pymc.ipynbuses.X, andInstrumentalVariablewas never migrated/deprecated)Made with Cursor