Skip to content
New issue

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

Adjust ate inference to get the exact stderr when final stage is linear. #418

Merged
merged 13 commits into from
Mar 3, 2021

Conversation

heimengqi
Copy link
Contributor

@heimengqi heimengqi commented Feb 22, 2021

Add some context for this implementation:
In order to get the analytical inference of E(theta(x)), we need to know stderr of E(theta(x)), however previously we could only get the conservative upper bound of it. Given the fact that only in linear cate scenario, E(theta(x))=theta(E(x)), and we could get STD(theta(E(x))) by calling prediction_stderr(X.mean(axis=0)), which will return the exact standard error of the mean.

For const_marginal_effect we learn theta(x) alone, then the stderr could be adjusted when final stage is linear in both continues and categorical scenario. For effect, in continues scenario we learn cross product of X and T (as XT), we get the stderr by calling prediction_stderr(XT.mean(axis=0)), in categorical scenario we learn the effect of a specific treatment comparing to baseline, for each sample, the effect could be different given what the treatment is. We couldn't learn theta(XT.mean(axis=0)) unless T1 is a constant or a list of constant. So I only adjust effect_inference only when T1 is a constant or list of constant.

@heimengqi heimengqi marked this pull request as ready for review February 22, 2021 19:38
Copy link
Collaborator

@kbattocchi kbattocchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments, mostly minor. But shouldn't there also be something that tests that we get back a non-None mean_stderr for the linear case?

econml/inference/_inference.py Outdated Show resolved Hide resolved
econml/inference/_inference.py Outdated Show resolved Hide resolved
econml/inference/_inference.py Outdated Show resolved Hide resolved
econml/inference/_inference.py Outdated Show resolved Hide resolved
econml/inference/_inference.py Outdated Show resolved Hide resolved
econml/inference/_inference.py Outdated Show resolved Hide resolved
econml/inference/_inference.py Outdated Show resolved Hide resolved
econml/inference/_inference.py Outdated Show resolved Hide resolved
econml/inference/_inference.py Outdated Show resolved Hide resolved
econml/inference/_inference.py Outdated Show resolved Hide resolved
@heimengqi
Copy link
Contributor Author

A few comments, mostly minor. But shouldn't there also be something that tests that we get back a non-None mean_stderr for the linear case?

Sure. I will add a test around that. I also added some context about this PR to explain why I do it in this way. Please also help confirm the whether logic seems right to you.

Copy link
Collaborator

@kbattocchi kbattocchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@heimengqi heimengqi merged commit 08c906f into master Mar 3, 2021
@heimengqi heimengqi deleted the mehei/ateinference branch March 3, 2021 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants