Skip to content
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions econml/iv/dml/_dml.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,14 @@ def predict(self, Y, T, X=None, W=None, Z=None, sample_weight=None, groups=None)
TX_pred = np.tile(TX_pred.reshape(1, -1), (T.shape[0], 1))
Y_res = Y - Y_pred.reshape(Y.shape)
T_res = TXZ_pred.reshape(T.shape) - TX_pred.reshape(T.shape)
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
"""
)
return Y_res, T_res


Expand Down
Loading