If I fuse a learner with a filter method using makeFilterWrapper, then I know I can perform feature selection using that filter within a cross-validation loop. As I understand it, filterFeatures is called before each model fit and it calls generateFilterValuesData. But is it possible to retrieve the values generated by generateFilterValuesData, using that filter, within each iteration of cross validation?
For example:
library(survival)
library(mlr)
data(veteran)
set.seed(24601)
configureMlr(show.learner.output=TRUE, show.info=TRUE)
task_id = "MAS"
mas.task <- makeSurvTask(id = task_id, data = veteran, target = c("time", "status"))
mas.task <- createDummyFeatures(mas.task)
inner = makeResampleDesc("CV", iters=2, stratify=TRUE) # Tuning
outer = makeResampleDesc("CV", iters=3, stratify=TRUE) # Benchmarking
cox.lrn <- makeLearner(cl="surv.coxph", id = "coxph", predict.type="response")
cox.filt.uni.abs.lrn =
makeFilterWrapper(
makeLearner(cl="surv.coxph", id = "cox.filt.uni.abs", predict.type="response"),
fw.method="univariate.model.score",
fw.abs=7,
perf.learner=cox.lrn
)
learners = list( cox.filt.uni.abs.lrn )
bmr = benchmark(learners=learners, tasks=mas.task, resamplings=outer, measures=list(cindex), show.info = TRUE)
mods = getBMRModels(bmr, learner.ids = c('cox.filt.uni.abs.filtered'))
for (i in 1:length(mods[[task_id]]$cox.filt.uni.abs.filtered)) {
mod = mods$MAS$cox.filt.uni.abs.filtered[[i]]$learner.model[[1]]
print(str(mod, max.level=1))
**#Retrieve output of generateFilterValuesData here?**
}