MLR: cforest learner throws error in resampling

104 Views Asked by At

I am getting the following error when using mlr to do resampling on a conditional inference forest:

Error in Hmisc::rcorr.cens(-1 * y, s) : 
NA/NaN/Inf in foreign function call (arg 1)

My code is

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

For testing I have cut the data down to just 3 columns - times, status and one predictor - Glucose - and there are no NA, Inf or NaN values in the data. I can successfully train a cforest model on the data without using resampling:

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 

There are no character variables in the data. The structure of the data is:

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 ...

Why does the resampling not work? Where should I upload the data file so that others can try it out?

0

There are 0 best solutions below