Search code examples
feature-selectionmlrsurvival

Feature selection in mlr using univariate.model.score filter on censored data


I am trying to perform feature selection in R using mlr and the univariate.model.score filter. In the documentation it says that surv.rpart is the default learner for this filter. My dataset contains censored survival data and I would like to use a different learner, such as surv.coxph, but I am confused about how to do this. In other words I want the univariate.model.score filter to create its scores using the cindex and the Cox model.

Would I achieve that using makeFilterWrapper? E.g.

combo.task <- makeSurvTask(data = combo_baseline, target = c("timeToEvent", "status"))
cox.lrn <- makeLearner(cl="surv.coxph", predict.type="response")
inner = makeResampleDesc("CV", iters=5)
lrn = makeFilterWrapper(learner = cox.lrn, fw.method="univariate.model.score", fw.abs=10)
res = resample(learner = lrn, task = combo.task, resampling=inner, models=TRUE)
res$aggr

It is not possible for me to share the data, so I have not provided any, but I am hoping someone can just show me how to use the code correctly. Thanks.


Solution

  • I found the answer by reading the mlr code. The filter "univariate.model.score" takes an argument perf.learner which lets you specify the learner to be used in evaluating the performance of the filter. E.g.:

    combo.task <- makeSurvTask(data = combo_baseline, target = c("timeToEvent", "status"))
    cox.lrn <- makeLearner(cl="surv.coxph", predict.type="response")
    inner = makeResampleDesc("CV", iters=5)
    lrn = makeFilterWrapper(learner = cox.lrn, fw.method="univariate.model.score", fw.abs=10, perf.learner=cox.lrn)
    res = resample(learner = lrn, task = combo.task, resampling=inner, models=TRUE)
    

    It also takes arguments perf.measure, the performance measure, and perf.resampling, the resampling strategy.