In this introduction, we fit a classification tree on the iris and determine the mean misclassification error.

Task and learner objects

First, we need to generate the following mlr3 objects from the task dictionary and the learner dictionary, respectively:

  1. The classification task

  2. A learner for the classification tree

Index vector for train/test splits

We opt to learn on \(\frac{4}{5}\) of all available observations and predict on the remaining \(\frac{1}{5}\) observations. For this purpose, we create two index vectors:

train.set = sample(task$nrow, 4/5 * task$nrow)
test.set = setdiff(seq_len(task$nrow), train.set)

Setting up an experiment

The process of fitting a machine learning model, predicting on test data and scoring the predictions by comparing predicted and true labels is called an experiment. For this reason, we start by initializing an Experiment object:

The printer shows a summary of the state of the experiment, which is currently [defined] and includes the task and the learner.

Performance assessment

The last step of the experiment is quantifying the performance of the model by comparing the predicted labels with the true labels using a performance measure. The default measure for the iris classification task is the mean misclassification error, which is used here by default:

The experiment is now “complete” which means we can access all of its methods.