if (requireNamespace("FSelectorRcpp")) {
## Relief (default)
task = mlr3::tsk("iris")
filter = flt("relief")
filter$calculate(task)
head(filter$scores, 3)
as.data.table(filter)
}
if (mlr3misc::require_namespaces(c("mlr3pipelines", "FSelectorRcpp", "rpart"), quietly = TRUE)) {
library("mlr3pipelines")
task = mlr3::tsk("iris")
# Note: `filter.frac` is selected randomly and should be tuned.
graph = po("filter", filter = flt("relief"), filter.frac = 0.5) %>>%
po("learner", mlr3::lrn("classif.rpart"))
graph$train(task)
}
Run the code above in your browser using DataLab