NonParamDMLIV sometimes ZeroDivisionError
Open
@ronikobrosly is already working on this.
Since Aug 27, 2024.
- Dominant language
- Jupyter Notebook
- Stars
- 4.8k
- Forks
- 827
- PR merge metrics
- No merged PRs in 30d
Description
Seems that one can run into ZeroDivisionErrors when using NonParamDMLIV. Reproduction code below. Note, the error is not consistent. You may have to run it multiple times before getting the ZeroDivisionError.
From briefly looking into it, it seems the T residuals are all 0's when the error occurs.
econml version 0.15.0b1. Haven't tried other versions.
Let me know if I'm missing something!
from econml.iv.dml import NonParamDMLIV
import numpy as np
from sklearn.linear_model import LinearRegression
n = 100
d_x = 3
Y = np.random.normal(size=(n,))
T = np.random.normal(size=(n,))
X = np.random.normal(size=(n, d_x))
Z = np.random.normal(size=(n,))
est = NonParamDMLIV(discrete_instrument=False, discrete_treatment=False, model_final=LinearRegression())
est.fit(Y, T, Z=Z, X=X)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.