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

Can policy_tree handle missing values in covariate space (X)? #139

Open
njawadekar opened this issue Sep 28, 2022 · 1 comment
Open

Can policy_tree handle missing values in covariate space (X)? #139

njawadekar opened this issue Sep 28, 2022 · 1 comment
Labels
question Further information is requested

Comments

@njawadekar
Copy link

njawadekar commented Sep 28, 2022

I am using policytree, version 1.2.0, and I am specifically trying to implement policy learning on the doubly robust reward estimates derived from an honest causal forest (GRF package). While I believe that the GRF package can handle missing covariates (X), see info at link here, it appears that policy_tree cannot handle missing values, is that correct?

When I try running the following code, I get the error, "Covariate matrix X contains missing values". However, I did not get any error when running the causal forest on the same dataset. Please assist - thanks!

Compute doubly robust reward estimates from causal forest

Gamma.matrix <- double_robust_scores(causalf)
head(Gamma.matrix)

Fit a depth 2 tree on a random training subset of my sample

N = as.numeric(length(Y))
train <- sample(1:N, 3000)
opt.tree <- policy_tree(X[train, ], Gamma.matrix[train, ], depth = 2) This is where the error arose
opt.tree

@erikcs
Copy link
Member

erikcs commented Sep 28, 2022

Hi @njawadekar,
Sorry, policy_tree currently does not support missing X's. You could fit it using the non-missing units.

subset <- complete.cases(X)
tree <- policy_tree(X[subset, ], Gamma.matrix[subset, ])

@erikcs erikcs added the question Further information is requested label Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants