This object wraps the predictions returned by a learner of class LearnerForecast, i.e. the predicted response and standard error.
Chapter in the mlr3book: https://mlr3book.mlr-org.com/basics.html#train-predict
Package mlr3viz for some generic visualizations.
Extension packages for additional task types:
mlr3proba for probabilistic supervised regression and survival analysis.
mlr3cluster for unsupervised clustering.
mlr3::Prediction
-> PredictionForecast
new()
Creates a new instance of this R6 class.
PredictionForecast$new(
task = NULL,
row_ids = task$row_ids,
truth = task$truth(),
response = NULL,
se = NULL,
distr = NULL,
check = TRUE
)
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.
task = mlr3::tsk("airpassengers")
learner = mlr3::lrn("forecast.average")
learner$train(task, 1:30)
p = learner$predict(task, 31:50)
p$predict_types
#> [1] "response"
head(data.table::as.data.table(p))
#> row_ids target target
#> 1: 31 199 139.4
#> 2: 32 199 139.4
#> 3: 33 184 139.4
#> 4: 34 162 139.4
#> 5: 35 146 139.4
#> 6: 36 166 139.4