Website of the mlr3 ecosystem
An open-source machine learning framework providing a unified interface for machine learning in the R language.
future
package.
The mlr3verse meta-package installs mlr3 and some of the most important extension packages:
install.packages("mlr3verse")
Simple resampling:
library(mlr3verse)
task = tsk("penguins")
learner = lrn("classif.rpart", cp = .01)
resampling = rsmp("cv", folds = 3L)
rr = resample(task, learner, resampling)
rr$score(msr("classif.acc"))
Quick tuning of a simple classification tree on the on penguins data set:
library(mlr3tuningspaces)
task = tsk("penguins")
learner = lts(lrn("classif.rpart"))
instance = tune(
method = "random_search",
task = task,
learner = learner,
resampling = rsmp("cv", folds = 3),
measure = msr("classif.acc"),
term_evals = 10,
batch_size = 5
)
instance$result
Create a stacked learner:
library(mlr3verse)
library(mlr3pipelines)
task = tsk("german_credit")
base_learners = list(
lrn("classif.rpart", predict_type = "prob"),
lrn("classif.kknn", predict_type = "prob")
)
super_learner = lrn("classif.log_reg")
graph_stack = pipeline_stacking(base_learners, super_learner)
graph_learner = as_learner(graph_stack)
graph_learner$train(task)
If you use mlr3
, please cite our JOSS article:
@Article{mlr3,
title = {{mlr3}: A modern object-oriented machine learning framework in {R}},
author = {Michel Lang and Martin Binder and Jakob Richter and Patrick Schratz and Florian Pfisterer and Stefan Coors and Quay Au and Giuseppe Casalicchio and Lars Kotthoff and Bernd Bischl},
journal = {Journal of Open Source Software},
year = {2019},
month = {dec},
doi = {10.21105/joss.01903},
url = {https://joss.theoj.org/papers/10.21105/joss.01903},
}