This object stores the predictions returned by a learner of class LearnerDens.

The task_type is set to "dens".

See also

Other Prediction: PredictionSurv

Super class

mlr3::Prediction -> PredictionDens

Active bindings

pdf

(numeric())
Access the stored predicted probability density function.

cdf

(numeric())
Access the stored predicted cumulative distribution function.

distr

(Distribution)
Access the stored estimated distribution.

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage

PredictionDens$new(
  task = NULL,
  row_ids = task$row_ids,
  pdf = NULL,
  cdf = NULL,
  distr = NULL,
  check = TRUE
)

Arguments

task

(TaskSurv)
Task, used to extract defaults for row_ids.

row_ids

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

pdf

(numeric())
Numeric vector of estimated probability density function, evaluated at values in test set. One element for each observation in the test set.

cdf

(numeric())
Numeric vector of estimated cumulative distribution function, evaluated at values in test set. One element for each observation in the test set.

distr

(Distribution)
Distribution from distr6. The distribution from which pdf and cdf are derived.

check

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


Method clone()

The objects of this class are cloneable with this method.

Usage

PredictionDens$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

library(mlr3) task = mlr_tasks$get("precip") learner = mlr_learners$get("dens.hist") p = learner$train(task)$predict(task) head(as.data.table(p))
#> row_ids pdf cdf distr #> 1: 1 0.001428571 0.9957143 <Distribution[38]> #> 2: 2 0.007142857 0.9478571 <Distribution[38]> #> 3: 3 0.005714286 0.0400000 <Distribution[38]> #> 4: 4 0.030000000 0.8692857 <Distribution[38]> #> 5: 5 0.012857143 0.1085714 <Distribution[38]> #> 6: 6 0.012857143 0.1497143 <Distribution[38]>