4.3 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 a new Experiment object by passing the created TaskClassif and LearnerClassif:

e = Experiment$new(task = task, learner = learner)
print(e)
## <Experiment> [defined]:
##  + Task: iris
##  + Learner: classif.rpart
##  - Model: [missing]
##  - Predictions: [missing]
##  - Performance: [missing]

The printer shows a summary of the state of the experiment, which is currently in the state “defined” which basically means that the task and the learner are stored, but nothing else happened so far. By querying the state, the ordered factor levels tell us the other possible states of an experiment:

e$state
## [1] defined
## 5 Levels: undefined < defined < ... < scored