Merged
Conversation
1907ad6 to
8c12fda
Compare
Signed-off-by: Keith Battocchi <kebatt@microsoft.com>
Signed-off-by: Keith Battocchi <kebatt@microsoft.com>
8c12fda to
bb2a5e8
Compare
There was a problem hiding this comment.
Pull request overview
This PR addresses two important issues: correcting documentation examples to avoid linear dependence between bias terms and intercepts in OLS models, and fixing a bug in Jacobian calculation for PolynomialFeatures that produced NaN values when evaluated at zero.
- Fixed Jacobian calculation to avoid NaN when X contains zeros by only decrementing positive powers
- Updated documentation examples to set
include_bias=Falsefor featurizers when fitting models with intercepts - Added test coverage for the zero-value case in Jacobian calculation
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| econml/utilities.py | Fixed Jacobian calculation in _TransformerWrapper.jac() to avoid NaN by only decrementing positive polynomial powers |
| econml/iv/sieve/_tsls.py | Applied same Jacobian fix in DPolynomialFeatures.transform() for consistency |
| econml/tests/test_treatment_featurization.py | Updated test to use include_bias=True and added zero-value test case for NaN fix verification |
| doc/spec/estimation/dml.rst | Corrected include_bias parameter in examples and updated test setup, but introduced generator expression bugs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
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.
This makes two changes:
yasx^0 y^1, and generating a derivative with respect toxof0 x^(-1) y^1, which resulted in nan when evaluated at x=0 but 0 as expected when evaluated at any other value of x)