Object which stores the text output of the train or predict step of an Experiment.

Format

R6::R6Class object.

Construction

l = Log$new(log = NULL)
  • log :: data.table::data.table()
    Table with at least the columns "class" (allowed values are "output", "warning", and "error") and "msg" (character()). A third column "context" is optional, and currently only used for printing.

Fields

  • warnings :: character(1)
    Vector of all messages of class "warning".

  • errors :: character(1)
    Vector of all messages of class "error".

Methods

  • has_condition(cl)
    character(1) -> logical(1)
    Returns TRUE if at least one message with condition cl has been recorded.

Examples

# Create a simple experiment and extract the train log: task = mlr_tasks$get("sonar") learner = mlr_learners$get("classif.debug", param_vals = list(message_train = TRUE, error_train = TRUE)) learner$fallback = mlr_learners$get("classif.featureless") e = Experiment$new(task, learner) e$train(ctrl = list(encapsulate_train = "evaluate"))
#> INFO [mlr3] Training learner 'classif.debug' on task 'sonar' ...
#> <Experiment> [trained]: #> + Task: sonar #> + Learner: classif.debug #> + Model: [featureless] #> - Predictions: [missing] #> - Performance: [missing] #> #> Public: clone(), ctrl, data, has_errors, hash, learner, log(), model, #> performance, predict(), prediction, score(), seeds, state, task, #> test_set, timings, train_set, train(), validation_set
l = e$log() print(l)
#> <Log> with 2 messages: #> [OUT] train: Message from classif.debug->train() #> [ERR] train: Error from classif.debug->train()
l$has_condition("error")
#> [1] TRUE