task = tsk("pima")
learner = lrn("classif.rpart")
resampling = rsmp("cv", folds = 3)
# define function to extract selected features
selected_features = function(learner) list(selected_features = learner$selected_features())
# create callback
callback = clbk("mlr3.model_extractor", fun = selected_features)
rr = resample(task, learner, resampling = resampling, store_models = FALSE, callbacks = callback)
rr$data_extra
Run the code above in your browser using DataLab