PredictionOrdinal | R Documentation |
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) head(as.data.table(p))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.