Refactor framework class #376
Open
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.
Refactor DoubleMLFramework
This pull request refactors the creation and usage of the
DoubleMLFrameworkclass to require aDoubleMLCoreobject as an argument, rather than a dictionary of arrays. It also introduces a new test suite for validatingDoubleMLCore's input checks, and updates all relevant tests and code to use the new pattern. Additionally, some unused dictionary keys are removed from test utilities and framework construction.Core API Refactor:
The
DoubleMLFrameworkclass is now instantiated with aDoubleMLCoreobject (using thedml_coreargument) instead of a dictionary. All code and tests that previously passed a dictionary are updated to first create aDoubleMLCoreinstance and pass it toDoubleMLFramework.The
DoubleMLCoreclass is now imported and included in the public API.Test and Utility Updates:
All test fixtures and helper functions that previously constructed
DoubleMLFrameworkfrom a dictionary are updated to useDoubleMLCoreinstead.The test utility function
generate_dml_dictand framework construction inDoubleMLremove unused keys (thetas,ses,treatment_names) to match the new interface.Validation Improvements:
A new test suite
test_core_exceptions.pyis added to comprehensively check input validation and error handling inDoubleMLCore, including array shapes, types, and required dictionary keys. (doubleml/tests/test_core_exceptions.py)Framework Construction and Sensitivity:
DoubleMLCorewith updated sensitivity elements instead of mutating the existing framework.PR Checklist
Please fill out this PR checklist (see our contributing guidelines for details).