Skip to content

Commit

Permalink
Update econml/iv/dml/_dml.py
Browse files Browse the repository at this point in the history
Co-authored-by: Keith Battocchi <[email protected]>
Signed-off-by: Roni Kobrosly <[email protected]>
  • Loading branch information
ronikobrosly and kbattocchi authored Sep 27, 2024
1 parent 1df31c2 commit 70cc2dd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions econml/iv/dml/_dml.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,9 +764,14 @@ def predict(self, Y, T, X=None, W=None, Z=None, sample_weight=None, groups=None)
if T_res.sum() == 0:
raise ValueError(
"""
All values of the treatment residual are 0,
which then makes them unsuitable to use as weights
in downstream in econml/dml/dml.py
All values of the treatment residual are 0,
which then makes them unsuitable to use as weights.
DRIV requires that the instrument Z has an effect on the
expected treatment value of at least some rows.
If you are using regularized models, it's possible that this error is a
result of regularizing too strongly, so that all predictions from both
models are constant.
"""
)
return Y_res, T_res
Expand Down

0 comments on commit 70cc2dd

Please sign in to comment.