PredictionForecast: Prediction Object for Forecasting

PredictionForecastR Documentation

Prediction Object for Forecasting

Description

This object wraps the predictions returned by a learner of class LearnerForecast, i.e. the predicted response and standard error.

Super class

mlr3::Prediction -> PredictionForecast

Active bindings

response

(numeric())
Access the stored predicted response.

se

(numeric())
Access the stored standard error.

missing

(integer())
Returns row_ids for which the predictions are missing or incomplete.

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage
PredictionForecast$new(
  task = NULL,
  row_ids = task$row_ids,
  truth = task$truth(),
  response = NULL,
  se = 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.

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 print()

Printer.

Usage
PredictionForecast$print(...)
Arguments
...

(ignored).


Method conf_int()

Access to the stored predicted response.

Usage
PredictionForecast$conf_int(level = 95)
Arguments
level

(numeric(1))
Confidence level in percent.

See Also

Examples

task = mlr3::tsk("airpassengers")
learner = mlr3::lrn("forecast.average")
learner$train(task, 1:30)
p = learner$predict(task, 31:50)
p$predict_types
head(data.table::as.data.table(p))

mlr-org/mlr3forecasting documentation built on June 29, 2023, 11:57 p.m.