araastat / reprtree

Representative trees from ensembles
40 stars 33 forks source link

Problem in finding tree based on causalForest (from casualTree package) function #15

Open hakianmehr opened 3 years ago

hakianmehr commented 3 years ago

Hello,

I used the "casualForest" function from "causalTree" package, once I want to find the best tree by using "reprtree" function, I got the following error.

I really appreciate any help.

dataset: N observation:9000 outcome variable: categorical (0,1) W=categorical


cf <- causalForest(formula=fmla, data=forestX, treatment=forestX$W, split.Rule="CT", split.Honest=T, split.Bucket=F, bucketNum = 5, bucketMax = 100, cv.option="CT", cv.Honest=T, minsize = 2L, split.alpha = 0.5, cv.alpha = 0.5, sample.size.total = floor(nrow(forestX) / 2), sample.size.train.frac = .5, mtry = ceiling(ncol(forestX)/3), nodesize = 100, num.trees=10, ncolx=length(predictorsNames),ncov_sample=4)

ReprTree(cf,forestX,metric="d2") [1] "Constructing distance matrix..." Error in UseMethod("predict2") : no applicable method for 'predict2' applied to an object of class "causalForest"

ChiecyCheng commented 3 years ago

I've met the same problem as yours. I tried other packages designed for causal forest such as "grf" and "causalForest", but still couldn't find ways to visualize the model. Really upset.

zhaoxuan315 commented 1 year ago

I have the same problem as you, have you solved it?