Objects of type PredictionData
serve as a intermediate representation for objects of type Prediction.
It is an internal data structure, implemented to optimize runtime and solve some issues emerging while serializing R6 objects.
End-users typically do not need to worry about the details, package developers are advised to continue reading for some technical information.
Unlike most other mlr3 objects, PredictionData
relies on the S3 class system.
The following operations must be supported to extend mlr3 for new task types:
as_prediction_data()
converts objects to class PredictionData
, e.g. objects of type Prediction.
as_prediction()
converts objects to class Prediction, e.g. objects of type PredictionData
.
check_prediction_data()
is called on the return value of the predict method of a Learner to perform assertions and type conversions.
Returns an update object of class PredictionData
.
is_missing_prediction_data()
is used for the fallback learner (see Learner) to impute missing predictions. Returns vector with row ids which need imputation.
check_prediction_data(pdata)is_missing_prediction_data(pdata)
as_prediction_data(x, task, row_ids = task$row_ids, check = TRUE)
# S3 method for Prediction
as_prediction_data(x, task, row_ids = task$row_ids, check = TRUE)
# S3 method for PredictionData
as_prediction_data(x, task, row_ids = task$row_ids, check = TRUE)
# S3 method for list
as_prediction_data(x, task, row_ids = task$row_ids, check = TRUE)
as_prediction(x, check = TRUE)
# S3 method for Prediction
as_prediction(x, check = TRUE)
# S3 method for PredictionDataClassif
as_prediction(x, check = TRUE)
# S3 method for PredictionDataClassif
check_prediction_data(pdata)
# S3 method for PredictionDataClassif
is_missing_prediction_data(pdata)
# S3 method for PredictionDataClassif
c(..., keep_duplicates = TRUE)
# S3 method for PredictionDataRegr
as_prediction(x, check = TRUE)
# S3 method for PredictionDataRegr
check_prediction_data(pdata)
# S3 method for PredictionDataRegr
is_missing_prediction_data(pdata)
# S3 method for PredictionDataRegr
c(..., keep_duplicates = TRUE)
(PredictionData)
Named list inheriting from "PredictionData"
.
(any) Object to convert.
(Task).
(integer()
).
(logical(1)
)
Perform argument checks and conversions?
(one or more PredictionData objects).
(logical(1)
)
If TRUE
, the combined PredictionData object is filtered for duplicated
row ids (starting from last).