mlr3

Efficient, object-oriented programming on the building blocks of machine learning. Successor of mlr.

Build Status CircleCI CRAN_Status_Badge cran checks CRAN Downloads Lifecycle: maturing codecov StackOverflow Dependencies

Resources

Installation

remotes::install_github("mlr-org/mlr3")

Example

Constructing Learners and Tasks

library(mlr3)
set.seed(1)

# create learning task
task_iris = TaskClassif$new(id = "iris", backend = iris, target = "Species")
task_iris

# load learner and set hyperparamter
learner = lrn("classif.rpart", cp = 0.01)

Basic train + predict

# train/test split
train_set = sample(task_iris$nrow, 0.8 * task_iris$nrow)
test_set = setdiff(seq_len(task_iris$nrow), train_set)

# train the model
learner$train(task_iris, row_ids = train_set)

# predict data
prediction = learner$predict(task_iris, row_ids = test_set)

# calculate performance
prediction$confusion
measure = msr("classif.acc")
prediction$score(measure)

Resample

# automatic resampling
resampling = rsmp("cv", folds = 3L)
rr = resample(task_iris, learner, resampling)
rr$score(measure)
rr$aggregate(measure)

Why a rewrite?

mlr was first released to CRAN in 2013. Its core design and architecture date back even further. The addition of many features has led to a feature creep which makes mlr hard to maintain and hard to extend. We also think that while mlr was nicely extensible in some parts (learners, measures, etc.), other parts were less easy to extend from the outside. Also, many helpful R libraries did not exist at the time mlr was created, and their inclusion would result in non-trivial API changes.

Design principles

Talks, Workshops, etc.

mlr-outreach holds all outreach activities related to mlr and mlr3.

mlr3 talk at useR! 2019 conference in Toulouse, France:

Watch the video



mllg/mlr3 documentation built on Sept. 27, 2019, 9:38 a.m.