Skip to content
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

added warning message and test for issue #837 #919

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

ronikobrosly
Copy link

Hi @kbattocchi , could I get your 👀 on this?

Copy link
Collaborator

@kbattocchi kbattocchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! The fix actually needs to be made elsewhere - see my comment.

Comment on lines 837 to 845
if nuisances[1].sum() == 0:
raise ValueError(
"""
In fitting nuisances, the estimates for E[T|Z,X,W] are identical to E[T|X,W],
resulting in a situation where the rows will all be weighted to zero. Please
examine your instrument variable `Z`.
"""
)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't the right place to address this issue: it would apply to all OrthoLearner subclasses, including ones like LinearDRLearner that don't exhibit the bug, and the problem is not that the nuisances sum to 0, it's that all values of the treatment residual are 0, which then makes them unsuitable to use as weights here. However, that logic is not specific to NonParamDMLIV, so if you made the check there it wouldn't make sense to refer to E[T|Z,X,W]. Therefore it would probably be better to make the change here where the T residual is generated.

@ronikobrosly
Copy link
Author

Does this look better @kbattocchi ?

Copy link
Collaborator

@kbattocchi kbattocchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks much better, just needs a couple of tweaks.

econml/iv/dml/_dml.py Outdated Show resolved Hide resolved
econml/iv/dml/_dml.py Outdated Show resolved Hide resolved
ronikobrosly and others added 2 commits September 27, 2024 16:18
Co-authored-by: Keith Battocchi <[email protected]>
Signed-off-by: Roni Kobrosly <[email protected]>
Co-authored-by: Keith Battocchi <[email protected]>
Signed-off-by: Roni Kobrosly <[email protected]>
@ronikobrosly
Copy link
Author

Thank you for the suggestions and your patience @kbattocchi . Accepted your changes.

@kbattocchi
Copy link
Collaborator

One of your commits was not signed, so this is not passing the DCO check, see https://github.com/py-why/EconML/pull/919/checks?check_run_id=31527396832 for instructions on how to fix this (under Rebase the Branch).

Also it looks like the test that you had originally added has subsequently been removed in another commit - could you please add it back?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants