Closed Edward-Z-Chen closed 2 years ago
Thanks for catching the error! This is caused by an update of the grf
package. In the version I used to build this package, the predict
function for quantile_forest
in the grf
package would produce a data.frame but the latest one would produce a list
with the first attribute predictions
that includes the data.frame of predicted quantiles. I have updated the package on github. Please installed the package again.
Best, Lihua
Thanks! Now I can run my code successfully.
Best, Edward Chen
Hi,
When running the example you provided, I encountered the following error:
obj <- conformalCf(X, Y, type = "CQR", quantiles = c(0.05, 0.95), outfun = "quantRF", useCV = FALSE) Error in Yhat[, 1] - Y : non-numeric argument to binary operator
I found that when type=="CQR", the "Yhat" returned by Ymodel() in the 44th line of "conformal_split.R" is a list. As a parameter for conformalScore(), the code "Yhat[,1]" caused the previous error.
When replacing the 37th line of "conformal_utils.R" by "score <- pmax(Yhat[[1]][, 1] - Y, Y - Yhat[[1]][, 2])", the error will disappear. (Maybe first check if Yhat is a list is a safer way.)
The same error also occurred when using the result "obj" to make a new prediction by predict(), so the 104th and 105th lines of "conformal_split.R" should be similarly modified. I'm not quite sure whether these modifications will cause any new issues.
Best wishes, Chen