-
Notifications
You must be signed in to change notification settings - Fork 724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Fixes linear DRIV shape inconsistency" #920
Conversation
13924b9
to
c92104a
Compare
Thanks for the contribution. Unfortunately, these changes are causing test failures in Given that the shapes are as expected for other estimators (like |
Thanks, @kbattocchi! yes, I think the fix I have touches too many things. I'll look into something more local in _dr.py. |
c92104a
to
b7b78b4
Compare
@kbattocchi I made the change more local and fixed an edge case with the discrete outcome. The new version passes the tests I was failing before. |
Oh yes, that's a good point. I can drop the effect_interval method. The
change is in effect_inference.
…On Wed, Oct 2, 2024 at 11:13 AM Keith Battocchi ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In econml/inference/_inference.py
<#920 (comment)>:
> + def effect_interval(self, X, *, T0, T1, alpha=0.05):
+ return self.effect_inference(X, T0=T0, T1=T1).conf_int(alpha=alpha)
Isn't this identical to what the base class is already doing?
—
Reply to this email directly, view it on GitHub
<#920 (review)>,
|
b7b78b4
to
5c5d476
Compare
@kbattocchi Removed the redundant effect_interval method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for trying again, but I don't think StatsModelsInference is the right place for the change - see my comment.
econml/inference/_inference.py
Outdated
e_pred = reshape_outcomewise_effects(self._predict(XT), self._d_y) | ||
e_stderr = reshape_outcomewise_effects(self._prediction_stderr(XT), self._d_y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, the idea of StatsModelsInference compared to LinearModelFinalInference is just to allow setting the covariance estimation method for inference, not to affect any other aspect of the computation, so I think your previous change to that class would make more sense - perhaps with the additional check for ()
in your reshape_outcomewise_effects implementation changing the LinearModelFinalInference will no longer break other subclasses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(And I think you'll find that without fixing the change in LinearModelFinalInference, other DRIV subclasses like SparseLinearDRIV still suffer from the same issue - please consider modifying line 457 of test_treatment_featurization to enable further tests on DRIV subclasses)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kbattocchi Thanks, Keith, for the help. It makes sense what you are saying, I will work on a fix.
Signed-off-by: ssemov <ssemov@gmail.com>
5c5d476
to
7cc5ebc
Compare
Changes:
Tests:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Addresses the shape inconsistency in the linear DRIV implementation.
Changes:
Related [issue](#687).
Testing: