The mlr3book has a new chapter on validation and internal tuning
Learners
To keep the dependencies on other packages reasonable, the base package mlr3 only ships with with regression and classification trees from the rpart package and some learners for debugging. A subjective selection of implementations for essential ML algorithms can be found in mlr3learners package. Survival learners are provided by mlr3proba, cluster learners via mlr3cluster. Additional learners, including some learners which are not yet to be considered stable or which are not available on CRAN, are connected via the mlr3extralearners package. For neural networks, see the mlr3torch extension.
library("mlr3verse")# retrieve the tasktask =tsk("breast_cancer")# split into two partitionssplit =partition(task)# retrieve a learnerlearner =lrn("classif.rpart", keep_model =TRUE, predict_type ="prob")# fit decision treelearner$train(task, split$train)# access learned modellearner$model
# predict on data frame with new datapredictions = learner$predict_newdata(task$data(split$test))# predict on subset of the taskpredictions = learner$predict(task, split$test)# inspect predictionspredictions