Skip to content

Commit

Permalink
test(update DGP for test)
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Pieniazek <jacob@pieniazek.me>
  • Loading branch information
jakepenzak committed Nov 14, 2024
1 parent dd11c77 commit b2ba239
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions econml/tests/test_rscorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ def _get_data(self, discrete_outcome=False):
X = np.random.normal(0, 1, size=(100000, 2))
T = np.random.binomial(1, .5, size=(100000,))
if discrete_outcome:
y = (X[:, 0] * T + np.random.normal(size=(100000,)) > 0).astype(int)
eps = np.random.normal(size=(100000,))
log_odds = X[:, 0]*T + eps
y_sigmoid = 1/(1 + np.exp(-log_odds))
y = np.array([np.random.binomial(1, p) for p in y_sigmoid])
# Difference in conditional probabilities P(y=1|X,T=1) - P(y=0|X,T=0)
true_eff = (1 / (1 + np.exp(-X[:, 0]))) - (1 / (1 + np.exp(0)))
true_eff = (1 / (1 + np.exp(-(X[:, 0]+eps)))) - (1 / (1 + np.exp(-eps)))
else:
y = X[:, 0] * T + np.random.normal(size=(100000,))
true_eff = X[:, 0]
Expand Down

0 comments on commit b2ba239

Please sign in to comment.