PredictionRegr: Prediction Object for Regression

PredictionRegrR Documentation

Prediction Object for Regression

Description

This object wraps the predictions returned by a learner of class LearnerRegr, i.e. the predicted response and standard error. Additionally, probability distributions implemented in package distr6 are supported.

Super class

mlr3::Prediction -> PredictionRegr

Active bindings

response

(numeric())
Access the stored predicted response.

se

(numeric())
Access the stored standard error.

quantiles

(matrix())
Matrix of predicted quantiles. Observations are in rows, quantile (in ascending order) in columns.

distr

(VectorDistribution)
Access the stored vector distribution. Requires package distr6(in repository https://raphaels1.r-universe.dev) .

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage
PredictionRegr$new(
  task = NULL,
  row_ids = task$row_ids,
  truth = task$truth(),
  response = NULL,
  se = NULL,
  quantiles = NULL,
  distr = NULL,
  check = TRUE
)
Arguments
task

(TaskRegr)
Task, used to extract defaults for row_ids and truth.

row_ids

(integer())
Row ids of the predicted observations, i.e. the row ids of the test set.

truth

(numeric())
True (observed) response.

response

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

se

(numeric())
Numeric vector of predicted standard errors. One element for each observation in the test set.

quantiles

(matrix())
Numeric matrix of predicted quantiles. One row per observation, one column per quantile.

distr

(VectorDistribution)
VectorDistribution from package distr6 (in repository https://raphaels1.r-universe.dev). Each individual distribution in the vector represents the random variable 'survival time' for an individual observation.

check

(logical(1))
If TRUE, performs some argument checks and predict type conversions.


Method clone()

The objects of this class are cloneable with this method.

Usage
PredictionRegr$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other Prediction: Prediction, PredictionClassif

Examples

task = tsk("boston_housing")
learner = lrn("regr.featureless", predict_type = "se")
p = learner$train(task)$predict(task)
p$predict_types
head(as.data.table(p))

mlr3 documentation built on Oct. 18, 2024, 5:11 p.m.