This object stores the predictions returned by a learner of class LearnerOrdinal.
R6Class object inheriting from Prediction.
Inherits from Prediction
# Construction p = PredictionOrdinal$new(task, response, prob) # Members p$predict_types p$row_ids p$truth # S3 methods as.data.table(p)
task
(Task):
Task used for prediction. Used to extract row_ids
and truth
.
Set to NULL
to skip all argument checks during initialization.
Slots p$row_ids
and p$truth
need to be set manually in this case.
response
(factor()
| ordered()
): Vector of predicted class labels.
prob
(matrix
):
Numeric matrix of rank probabilities with one column for each rank in task$class_names
and one row for each observation in the test set.
$new()
initializes a new object of class Prediction.
$predict_types
(character) stores the predict types available: a subset of c("response", "prob")
.
$response
stores the predicted values.
row_ids
stores the row IDs.
$truth
stores the true rank vector.
The prediction object can be transformed to a simple data.table()
with data.table::as.data.table.
library(mlr3) task = mlr_tasks$get("winerating") learner = mlr_learners$get("ordinal.clm") p = learner$train(task)$predict(task)#> Warning: (1) Hessian is numerically singular: parameters are not uniquely determined #> In addition: Absolute convergence criterion was met, but relative criterion was not met#> Warning: predictions from column rank-deficient fit may be misleading#> row_id truth response #> 1: 1 2 2 #> 2: 2 3 3 #> 3: 3 3 3 #> 4: 4 4 4 #> 5: 5 4 4 #> 6: 6 4 4