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

add estimate_counterfactual_outcomes for W in {0,1} #403 #411

Closed
wants to merge 14 commits into from

Conversation

ras44
Copy link
Contributor

@ras44 ras44 commented Apr 26, 2019

A start to providing the functionality requested in #403 (comment):

Finally, it would be nice to provide a short function which performs the above steps, or at least add this information to our algorithm reference.

This does not include the general calculation if multiple, or non {0,1} outcomes exist, but happy to consider that if helpful.

Copy link
Member

@halflearned halflearned left a comment

Choose a reason for hiding this comment

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

Hi @ras44, thank you for the changes! The code looks fine to me, just have a few comments on style and documentation.

r-package/grf/R/average_treatment_effect.R Outdated Show resolved Hide resolved
r-package/grf/R/average_treatment_effect.R Outdated Show resolved Hide resolved
r-package/grf/R/average_treatment_effect.R Outdated Show resolved Hide resolved
@ras44
Copy link
Contributor Author

ras44 commented May 3, 2019

@halflearned Thanks for your review! I've tried to address all items, but please let me know if I missed anything.

I also condensed the format of the returned list slightly (use Y.hats[['0']] or Y.hats$`0` instead of the redundant Y.hats$Y.hat.0) and included a test that W.orig is binary until multi-level treatments are supported. Let me know if you'd prefer something different or to revert.

Two additional questions:

@ras44
Copy link
Contributor Author

ras44 commented May 12, 2019

@halflearned just pinging you on this PR review, thanks

@halflearned
Copy link
Member

Hi @ras44, sorry for the delay. To answer your questions.

Also, could you add a short test to the R test codebase?

@ras44 ras44 changed the title add average_outcomes_X_W for W in {0,1} #403 add estimate_counterfactual_outcomes for W in {0,1} #403 May 27, 2019
@ras44
Copy link
Contributor Author

ras44 commented May 27, 2019

Hi @halflearned, thanks for your review. I hope the above commits address the outstanding issues, but please let me know if I can make any other modifications 👍

@jtibshirani jtibshirani requested a review from swager May 27, 2019 17:32
@halflearned
Copy link
Member

Hey @ras44, thanks for all the work! Just letting you know that your PR needs some additional vetting from other members of the team, and we'll get back to you as soon as possible. Sorry for the wait! Smaller PRs like this usually don't take long, but you just happen to catch us in a bit of a busy couple of weeks.

@ras44
Copy link
Contributor Author

ras44 commented May 30, 2019

no problem, @halflearned Thanks for your note! 👍

@ras44
Copy link
Contributor Author

ras44 commented Jul 9, 2019

@halflearned @swager I just merged in master to keep this branch fresh, it should be ready to go for review whenever you're ready 👍

@erikcs
Copy link
Member

erikcs commented Jul 10, 2019

Hi @ras44, can you please run Rscript build_package.R on your machine? (there are some error messages there)

@ras44
Copy link
Contributor Author

ras44 commented Jul 10, 2019

@erikcs thanks for your note. Just to make sure I'm looking at the right error messages, did you mean the linting errors? eg:

tests/testthat/test_regression_forest.R:212:49: style: Put spaces around all infix operators.

If so, I see linting errors arise for many of the files that I merged in from master, not only the ones that I have worked on in my branch.

@erikcs
Copy link
Member

erikcs commented Jul 10, 2019

Can you please try to remove.packages("lintr"); devtools::install_github("jimhester/lintr")? (you can get rid of all the Trailing whitespace is superfluous errors by opening your files in Atom and just saving them there, Atom removes unnecessary white space).

@ras44
Copy link
Contributor Author

ras44 commented Jul 11, 2019

It looks like the jimhester/lintr resolved the issues I was seeing with other files. I then fixed the linting errors in the two files modified for this PR. Please let me know if you see any further issues.

@erikcs
Copy link
Member

erikcs commented Jul 11, 2019

Thanks @ras44, sorry for the trouble (I should add a note on that (far from obvious) lintr incompatibility to the contributing documentation)

@ras44
Copy link
Contributor Author

ras44 commented Jul 11, 2019

No problem 👍 Thanks for your help!

@ras44
Copy link
Contributor Author

ras44 commented Aug 4, 2019

@swager just pulled in master to keep this PR current. It should be ready for review whenever you're ready, thanks!

@ras44
Copy link
Contributor Author

ras44 commented Aug 21, 2019

@swager just following up- I'm happy to close this PR if it's not moving in the right direction 👍

@swager
Copy link
Member

swager commented Aug 28, 2019

First of all, I'm sorry @ras44 for my very slow response on this. We spent quite a bit of time discussing this internally.

When adding new functions to GRF, there's always a trade-off between how much value they add, and the cost of maintaining them. In this case, estimating the counterfactual response surfaces is not one of the most common use cases of the package -- and, at the same time, there's very low overhead for a user who wants this functionality to write their own script (for example, the function est_counterfactual_outcomes doesn't call into any private functions, so someone who wanted to use it could just copy-paste the function and use it directly). For this reason, we're not going to merge this function now.

On a brighter note, I'll mention that @erikcs is currently working on an add-on package to GRF with a focus on policy learning that will also support similar functionality (i.e., provide estimates of treatment-specific regression surfaces based on causal_forest, including in the case with many treatments). So hopefully in the near future that'll also be an option for users who need functionality of this type.

@swager swager closed this Aug 28, 2019
@ras44
Copy link
Contributor Author

ras44 commented Aug 28, 2019

@swager no problem- thanks for following up!

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.

None yet

5 participants