使用mlr对条件推理林进行重采样时,出现以下错误:
Error in Hmisc::rcorr.cens(-1 * y, s) :
NA/NaN/Inf in foreign function call (arg 1)
我的代码是
surv.task <- makeSurvTask(data = bb_imp2, target = c("timeToEvent", "status"))
surv.learner <- makeLearner(cl="surv.cforest", predict.type="response", mtry=5)
rdesc <- makeResampleDesc(method="CV", iters=2)
r = resample(surv.learner, surv.task, rdesc)
r
为了进行测试,我将数据缩减为3列-时间,状态和一个预测变量-葡萄糖-数据中没有NA,Inf或NaN值。我可以在不使用重采样的情况下成功地在数据上训练Cforest模型:
surv.task <- makeSurvTask(data = bb_imp2, target = c("timeToEvent", "status"))
surv.learner <- makeLearner(cl="surv.cforest", predict.type="response", mtry=5)
blood_cforest <- train(surv.learner, surv.task)
getLearnerModel(blood_cforest)
Random Forest using Conditional Inference Trees
Number of trees: 500
Response: Surv(timeToEvent, status, type = "right")
Input: Glucose
Number of observations: 873
数据中没有字符变量。数据的结构为:
str(bb_imp2)
'data.frame': 873 obs. of 3 variables:
$ timeToEvent: num 373 2934 397 3005 2930 ...
$ status : int 0 0 0 0 0 0 0 0 0 0 ...
$ Glucose : num 5.2 5.6 6.7 5.5 6.1 5.9 5.8 5.7 7.7 5.5 ...
为什么重采样不起作用?我应该在哪里上传数据文件,以便其他人可以尝试?