This object stores the predictions returned by a learner of class LearnerRegr. The field task_type is set to "classif".

Format

R6::R6Class object inheriting from Prediction.

Construction

p = PredictionRegr$new(task = NULL, response = NULL, se = NULL)
  • task :: TaskRegr
    Task for which the predictions are made. Used to extract the row ids and the true response. Must be subsetted to test set.

  • response :: numeric()
    Vector of numeric response values. One element for each observation in the test set.

  • se :: numeric()
    Numeric vector of predicted standard error. One element for each observation in the test set.

Note that it is allowed to initialize this object without any arguments in order to allow to manually construct Prediction objects in a piecemeal fashion. Required are "row_ids", "truth", and "predict_type". Depending on the value of "predict_types", also "response" and "se" must be set.

Fields

  • row_ids :: (integer() | character())
    Vector of row ids for which predictions are stored.

  • truth :: any
    Vector of true labels.

  • response :: any
    Vector of predicted labels.

  • task_type :: character(1)
    Stores the type of the Task.

  • predict_types :: character()
    Vector of predict types this object stores.

See also

Other Prediction: PredictionClassif, Prediction

Examples

task = mlr_tasks$get("bh") learner = mlr_learners$get("regr.featureless") learner$predict_type = "se" e = Experiment$new(task, learner)$train()$predict()
#> INFO [mlr3] Training learner 'regr.featureless' on task 'bh' ... #> INFO [mlr3] Predicting with model of learner 'regr.featureless' on task 'bh' ...
p = e$prediction p$predict_types
#> [1] "response" "se"
#> row_id response truth se #> 1: 1 22.53281 24.0 9.197104 #> 2: 2 22.53281 21.6 9.197104 #> 3: 3 22.53281 34.7 9.197104 #> 4: 4 22.53281 33.4 9.197104 #> 5: 5 22.53281 36.2 9.197104 #> 6: 6 22.53281 28.7 9.197104