We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I noticed that this code doesn't work when the user has already the predictions. HI wrote this code and can be added to tmle.py.
This code gives slightly different results. I hope the writers of EconML fix the code and add it:
def tmle_est_given_preds(self, X, a, y, Q1, Q0, g): n = X.shape[0]
Q = a * Q1 + (1-a) * Q0 Q = Q.reshape(-1, 1) clever = a / g - (1 - a) / (1 - g) g = g.reshape(-1, 1) target_scaler_ = sklearn.preprocessing.MinMaxScaler(feature_range=(0, 1)) target_scaler_.fit(y) y_rescale = target_scaler_.transform(y) Q_rescale = target_scaler_.transform(Q) Q1_rescale = target_scaler_.transform(Q1.reshape(-1, 1)) Q0_rescale = target_scaler_.transform(Q0.reshape(-1, 1)) Q_rescale = _logit(Q_rescale) Q1_pred = _logit(Q1_rescale) Q0_pred = _logit(Q0_rescale) targeted_outcome_model = sm.GLM( endog=y_rescale.flatten(), exog=clever.flatten(), offset=Q_rescale.flatten(), family=sm.families.Binomial(), ).fit() epsilon = targeted_outcome_model.params[0] logit_Q1_star = Q1_pred + epsilon / g logit_Q0_star = Q0_pred - epsilon / (1 - g) Q1_star = target_scaler_.inverse_transform(_expit(logit_Q1_star)) Q0_star = target_scaler_.inverse_transform(_expit(logit_Q0_star)) est = (Q1_star - Q0_star).mean() phi = (a * (y - Q1_star) / g) - ((1 - a) * (y - Q0_star) / (1 - g)) + (Q1_star - Q0_star) - est var =( (phi - phi.mean()) ** 2).mean() / n return est, var
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I noticed that this code doesn't work when the user has already the predictions. HI wrote this code and can be added to tmle.py.
This code gives slightly different results. I hope the writers of EconML fix the code and add it:
def tmle_est_given_preds(self, X, a, y, Q1, Q0, g):
n = X.shape[0]
The text was updated successfully, but these errors were encountered: