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
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 forrow_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 whichpdf
andcdf
are derived.check
(
logical(1)
)
IfTRUE
, performs argument checks and predict type conversions.
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
#> <int> <num> <num>
#> 1: 1 0.001428571 0.9957143
#> 2: 2 0.007142857 0.9478571
#> 3: 3 0.005714286 0.0400000
#> 4: 4 0.030000000 0.8692857
#> 5: 5 0.012857143 0.1085714
#> 6: 6 0.012857143 0.1497143
#> distr
#> <list>
#> 1: <Distribution>\n Public:\n alias: \n cdf: function (..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, \n clone: function (deep = FALSE) \n confidence: function (alpha = 0.95, sides = "both", median = FALSE) \n correlation: function () \n decorators: active binding\n description: NULL\n dmax: active binding\n dmin: active binding\n getParameterValue: function (id, error = "warn") \n inf: active binding\n initialize: function (name = NULL, short_name = NULL, type, support = NULL, \n iqr: function () \n kurtosisType: active binding\n liesInSupport: function (x, all = TRUE, bound = FALSE) \n liesInType: function (x, all = TRUE, bound = FALSE) \n median: function (na.rm = NULL, ...) \n name: Histogram Estimator\n parameters: function (id = NULL) \n pdf: function (..., log = FALSE, simplify = TRUE, data = NULL) \n prec: function () \n print: function (n = 2, ...) \n properties: active binding\n quantile: function (..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, \n rand: function (n, simplify = TRUE) \n setParameterValue: function (..., lst = list(...), error = "warn", resolveConflicts = FALSE) \n short_name: Histogram\n skewnessType: active binding\n stdev: function () \n strprint: function (n = 2) \n summary: function (full = TRUE, ...) \n sup: active binding\n support: active binding\n symmetry: active binding\n traits: active binding\n type: active binding\n valueSupport: active binding\n variateForm: active binding\n workingSupport: function () \n Private:\n .cdf: function (x, self = <environment>, ...) \n .decorators: NULL\n .isCdf: 1\n .isPdf: 1\n .isQuantile: 0\n .isRand: 0\n .log: FALSE\n .parameters: NULL\n .pdf: function (x, self = <environment>, ...) \n .properties: list\n .traits: list\n .updateDecorators: function (decs) \n .variates: 1
#> 2: <Distribution>\n Public:\n alias: \n cdf: function (..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, \n clone: function (deep = FALSE) \n confidence: function (alpha = 0.95, sides = "both", median = FALSE) \n correlation: function () \n decorators: active binding\n description: NULL\n dmax: active binding\n dmin: active binding\n getParameterValue: function (id, error = "warn") \n inf: active binding\n initialize: function (name = NULL, short_name = NULL, type, support = NULL, \n iqr: function () \n kurtosisType: active binding\n liesInSupport: function (x, all = TRUE, bound = FALSE) \n liesInType: function (x, all = TRUE, bound = FALSE) \n median: function (na.rm = NULL, ...) \n name: Histogram Estimator\n parameters: function (id = NULL) \n pdf: function (..., log = FALSE, simplify = TRUE, data = NULL) \n prec: function () \n print: function (n = 2, ...) \n properties: active binding\n quantile: function (..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, \n rand: function (n, simplify = TRUE) \n setParameterValue: function (..., lst = list(...), error = "warn", resolveConflicts = FALSE) \n short_name: Histogram\n skewnessType: active binding\n stdev: function () \n strprint: function (n = 2) \n summary: function (full = TRUE, ...) \n sup: active binding\n support: active binding\n symmetry: active binding\n traits: active binding\n type: active binding\n valueSupport: active binding\n variateForm: active binding\n workingSupport: function () \n Private:\n .cdf: function (x, self = <environment>, ...) \n .decorators: NULL\n .isCdf: 1\n .isPdf: 1\n .isQuantile: 0\n .isRand: 0\n .log: FALSE\n .parameters: NULL\n .pdf: function (x, self = <environment>, ...) \n .properties: list\n .traits: list\n .updateDecorators: function (decs) \n .variates: 1
#> 3: <Distribution>\n Public:\n alias: \n cdf: function (..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, \n clone: function (deep = FALSE) \n confidence: function (alpha = 0.95, sides = "both", median = FALSE) \n correlation: function () \n decorators: active binding\n description: NULL\n dmax: active binding\n dmin: active binding\n getParameterValue: function (id, error = "warn") \n inf: active binding\n initialize: function (name = NULL, short_name = NULL, type, support = NULL, \n iqr: function () \n kurtosisType: active binding\n liesInSupport: function (x, all = TRUE, bound = FALSE) \n liesInType: function (x, all = TRUE, bound = FALSE) \n median: function (na.rm = NULL, ...) \n name: Histogram Estimator\n parameters: function (id = NULL) \n pdf: function (..., log = FALSE, simplify = TRUE, data = NULL) \n prec: function () \n print: function (n = 2, ...) \n properties: active binding\n quantile: function (..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, \n rand: function (n, simplify = TRUE) \n setParameterValue: function (..., lst = list(...), error = "warn", resolveConflicts = FALSE) \n short_name: Histogram\n skewnessType: active binding\n stdev: function () \n strprint: function (n = 2) \n summary: function (full = TRUE, ...) \n sup: active binding\n support: active binding\n symmetry: active binding\n traits: active binding\n type: active binding\n valueSupport: active binding\n variateForm: active binding\n workingSupport: function () \n Private:\n .cdf: function (x, self = <environment>, ...) \n .decorators: NULL\n .isCdf: 1\n .isPdf: 1\n .isQuantile: 0\n .isRand: 0\n .log: FALSE\n .parameters: NULL\n .pdf: function (x, self = <environment>, ...) \n .properties: list\n .traits: list\n .updateDecorators: function (decs) \n .variates: 1
#> 4: <Distribution>\n Public:\n alias: \n cdf: function (..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, \n clone: function (deep = FALSE) \n confidence: function (alpha = 0.95, sides = "both", median = FALSE) \n correlation: function () \n decorators: active binding\n description: NULL\n dmax: active binding\n dmin: active binding\n getParameterValue: function (id, error = "warn") \n inf: active binding\n initialize: function (name = NULL, short_name = NULL, type, support = NULL, \n iqr: function () \n kurtosisType: active binding\n liesInSupport: function (x, all = TRUE, bound = FALSE) \n liesInType: function (x, all = TRUE, bound = FALSE) \n median: function (na.rm = NULL, ...) \n name: Histogram Estimator\n parameters: function (id = NULL) \n pdf: function (..., log = FALSE, simplify = TRUE, data = NULL) \n prec: function () \n print: function (n = 2, ...) \n properties: active binding\n quantile: function (..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, \n rand: function (n, simplify = TRUE) \n setParameterValue: function (..., lst = list(...), error = "warn", resolveConflicts = FALSE) \n short_name: Histogram\n skewnessType: active binding\n stdev: function () \n strprint: function (n = 2) \n summary: function (full = TRUE, ...) \n sup: active binding\n support: active binding\n symmetry: active binding\n traits: active binding\n type: active binding\n valueSupport: active binding\n variateForm: active binding\n workingSupport: function () \n Private:\n .cdf: function (x, self = <environment>, ...) \n .decorators: NULL\n .isCdf: 1\n .isPdf: 1\n .isQuantile: 0\n .isRand: 0\n .log: FALSE\n .parameters: NULL\n .pdf: function (x, self = <environment>, ...) \n .properties: list\n .traits: list\n .updateDecorators: function (decs) \n .variates: 1
#> 5: <Distribution>\n Public:\n alias: \n cdf: function (..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, \n clone: function (deep = FALSE) \n confidence: function (alpha = 0.95, sides = "both", median = FALSE) \n correlation: function () \n decorators: active binding\n description: NULL\n dmax: active binding\n dmin: active binding\n getParameterValue: function (id, error = "warn") \n inf: active binding\n initialize: function (name = NULL, short_name = NULL, type, support = NULL, \n iqr: function () \n kurtosisType: active binding\n liesInSupport: function (x, all = TRUE, bound = FALSE) \n liesInType: function (x, all = TRUE, bound = FALSE) \n median: function (na.rm = NULL, ...) \n name: Histogram Estimator\n parameters: function (id = NULL) \n pdf: function (..., log = FALSE, simplify = TRUE, data = NULL) \n prec: function () \n print: function (n = 2, ...) \n properties: active binding\n quantile: function (..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, \n rand: function (n, simplify = TRUE) \n setParameterValue: function (..., lst = list(...), error = "warn", resolveConflicts = FALSE) \n short_name: Histogram\n skewnessType: active binding\n stdev: function () \n strprint: function (n = 2) \n summary: function (full = TRUE, ...) \n sup: active binding\n support: active binding\n symmetry: active binding\n traits: active binding\n type: active binding\n valueSupport: active binding\n variateForm: active binding\n workingSupport: function () \n Private:\n .cdf: function (x, self = <environment>, ...) \n .decorators: NULL\n .isCdf: 1\n .isPdf: 1\n .isQuantile: 0\n .isRand: 0\n .log: FALSE\n .parameters: NULL\n .pdf: function (x, self = <environment>, ...) \n .properties: list\n .traits: list\n .updateDecorators: function (decs) \n .variates: 1
#> 6: <Distribution>\n Public:\n alias: \n cdf: function (..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, \n clone: function (deep = FALSE) \n confidence: function (alpha = 0.95, sides = "both", median = FALSE) \n correlation: function () \n decorators: active binding\n description: NULL\n dmax: active binding\n dmin: active binding\n getParameterValue: function (id, error = "warn") \n inf: active binding\n initialize: function (name = NULL, short_name = NULL, type, support = NULL, \n iqr: function () \n kurtosisType: active binding\n liesInSupport: function (x, all = TRUE, bound = FALSE) \n liesInType: function (x, all = TRUE, bound = FALSE) \n median: function (na.rm = NULL, ...) \n name: Histogram Estimator\n parameters: function (id = NULL) \n pdf: function (..., log = FALSE, simplify = TRUE, data = NULL) \n prec: function () \n print: function (n = 2, ...) \n properties: active binding\n quantile: function (..., lower.tail = TRUE, log.p = FALSE, simplify = TRUE, \n rand: function (n, simplify = TRUE) \n setParameterValue: function (..., lst = list(...), error = "warn", resolveConflicts = FALSE) \n short_name: Histogram\n skewnessType: active binding\n stdev: function () \n strprint: function (n = 2) \n summary: function (full = TRUE, ...) \n sup: active binding\n support: active binding\n symmetry: active binding\n traits: active binding\n type: active binding\n valueSupport: active binding\n variateForm: active binding\n workingSupport: function () \n Private:\n .cdf: function (x, self = <environment>, ...) \n .decorators: NULL\n .isCdf: 1\n .isPdf: 1\n .isQuantile: 0\n .isRand: 0\n .log: FALSE\n .parameters: NULL\n .pdf: function (x, self = <environment>, ...) \n .properties: list\n .traits: list\n .updateDecorators: function (decs) \n .variates: 1