PredictionData: Convert to PredictionData

PredictionDataR Documentation

Convert to PredictionData

Description

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.

Usage

check_prediction_data(pdata, ...)

is_missing_prediction_data(pdata, ...)

filter_prediction_data(pdata, row_ids, ...)

## S3 method for class 'PredictionDataClassif'
check_prediction_data(pdata, train_task, ...)

## S3 method for class 'PredictionDataClassif'
is_missing_prediction_data(pdata, ...)

## S3 method for class 'PredictionDataClassif'
c(..., keep_duplicates = TRUE)

## S3 method for class 'PredictionDataRegr'
check_prediction_data(pdata, ...)

## S3 method for class 'PredictionDataRegr'
is_missing_prediction_data(pdata, ...)

## S3 method for class 'PredictionDataRegr'
c(..., keep_duplicates = TRUE)

Arguments

pdata

(PredictionData)
Named list inheriting from "PredictionData".

...

(one or more PredictionData objects).

row_ids

integer()
Row indices.

train_task

(Task)
Task used for training the learner.

keep_duplicates

(logical(1)) If TRUE, the combined PredictionData object is filtered for duplicated row ids (starting from last).


mlr3 documentation built on Nov. 17, 2023, 5:07 p.m.