4.4 Training

To train the learner on the task, we need to call the train function of the experiment:

e$train(row_ids = train_set)
## INFO [mlr3] Training learner 'classif.rpart' on task 'iris' ...
## <Experiment> [trained]:
##  + Task: iris
##  + Learner: classif.rpart
##  + Model: [rpart]
##  - Predictions: [missing]
##  - Performance: [missing]
print(e)
## <Experiment> [trained]:
##  + Task: iris
##  + Learner: classif.rpart
##  + Model: [rpart]
##  - Predictions: [missing]
##  - Performance: [missing]

The printer indicates that the Experiment object was modified (its state is now [trained]) and was also extended, since the object now includes a rpart model:

rpart.model = e$model
print(rpart.model)
## n= 120 
## 
## node), split, n, loss, yval, (yprob)
##       * denotes terminal node
## 
## 1) root 120 76 versicolor (0.32500 0.36667 0.30833)  
##   2) Petal.Length< 2.6 39  0 setosa (1.00000 0.00000 0.00000) *
##   3) Petal.Length>=2.6 81 37 versicolor (0.00000 0.54321 0.45679)  
##     6) Petal.Width< 1.75 46  3 versicolor (0.00000 0.93478 0.06522) *
##     7) Petal.Width>=1.75 35  1 virginica (0.00000 0.02857 0.97143) *