Takes in a `Prediction`

of `predict_type`

`"prob"`

(for `PredictionClassif`

) or `"se"`

(for `PredictionRegr`

). and generates a randomized `"response"`

prediction.

For `"prob"`

, the responses are sampled according to
the probabilities of the input `PredictionClassif`

. For `"se"`

,
responses are randomly drawn according to the `rdistfun`

parameter (default is `rnorm`

) by using
the original responses of the input `PredictionRegr`

as the mean and the
original standard errors of the input `PredictionRegr`

as the standard
deviation (sampling is done observation-wise).

`R6Class`

object inheriting from `PipeOp`

.

PipeOpRandomResponse$new(id = "randomresponse", param_vals = list(), packages = character(0))

`id`

::`character(1)`

Identifier of the resulting object, default`"randomresponse"`

.`param_vals`

:: named`list`

List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default`list()`

.packages ::

`character`

Set of all required packages for the`private$.predict()`

methods related to the`rdistfun`

parameter. Default is`character(0)`

.

`PipeOpRandomResponse`

has one input channel named `"input"`

, taking `NULL`

during training and
a `Prediction`

during prediction.

`PipeOpRandomResponse`

has one output channel named `"output"`

, producing `NULL`

during
training and a `Prediction`

with random responses during prediction.

The `$state`

is left empty (`list()`

).

`rdistfun`

::`function`

A function for generating random responses when the predict type is`"se"`

. This function must accept the arguments`n`

(integerish number of responses),`mean`

(`numeric`

for the mean), and`sd`

(`numeric`

for the standard deviation), and must*vectorize*over`mean`

and`sd`

. Default is`rnorm`

.

If the `predict_type`

of the input `Prediction`

does not match `"prob"`

or
`"se"`

, the input `Prediction`

will be returned unaltered.

Only fields inherited from `PipeOp`

.

Only methods inherited from `PipeOp`

.

Other PipeOps:
`PipeOpEnsemble`

,
`PipeOpImpute`

,
`PipeOpProxy`

,
`PipeOpTargetTrafo`

,
`PipeOpTaskPreprocSimple`

,
`PipeOpTaskPreproc`

,
`PipeOp`

,
`mlr_pipeops_boxcox`

,
`mlr_pipeops_branch`

,
`mlr_pipeops_chunk`

,
`mlr_pipeops_classbalancing`

,
`mlr_pipeops_classifavg`

,
`mlr_pipeops_classweights`

,
`mlr_pipeops_colapply`

,
`mlr_pipeops_collapsefactors`

,
`mlr_pipeops_copy`

,
`mlr_pipeops_datefeatures`

,
`mlr_pipeops_encodeimpact`

,
`mlr_pipeops_encodelmer`

,
`mlr_pipeops_encode`

,
`mlr_pipeops_featureunion`

,
`mlr_pipeops_filter`

,
`mlr_pipeops_fixfactors`

,
`mlr_pipeops_histbin`

,
`mlr_pipeops_ica`

,
`mlr_pipeops_imputeconstant`

,
`mlr_pipeops_imputehist`

,
`mlr_pipeops_imputelearner`

,
`mlr_pipeops_imputemean`

,
`mlr_pipeops_imputemedian`

,
`mlr_pipeops_imputemode`

,
`mlr_pipeops_imputeoor`

,
`mlr_pipeops_imputesample`

,
`mlr_pipeops_kernelpca`

,
`mlr_pipeops_learner`

,
`mlr_pipeops_missind`

,
`mlr_pipeops_modelmatrix`

,
`mlr_pipeops_multiplicityexply`

,
`mlr_pipeops_multiplicityimply`

,
`mlr_pipeops_mutate`

,
`mlr_pipeops_nop`

,
`mlr_pipeops_ovrsplit`

,
`mlr_pipeops_ovrunite`

,
`mlr_pipeops_pca`

,
`mlr_pipeops_quantilebin`

,
`mlr_pipeops_regravg`

,
`mlr_pipeops_removeconstants`

,
`mlr_pipeops_renamecolumns`

,
`mlr_pipeops_replicate`

,
`mlr_pipeops_scalemaxabs`

,
`mlr_pipeops_scalerange`

,
`mlr_pipeops_scale`

,
`mlr_pipeops_select`

,
`mlr_pipeops_smote`

,
`mlr_pipeops_spatialsign`

,
`mlr_pipeops_subsample`

,
`mlr_pipeops_targetinvert`

,
`mlr_pipeops_targetmutate`

,
`mlr_pipeops_targettrafoscalerange`

,
`mlr_pipeops_textvectorizer`

,
`mlr_pipeops_threshold`

,
`mlr_pipeops_unbranch`

,
`mlr_pipeops_updatetarget`

,
`mlr_pipeops_yeojohnson`

,
`mlr_pipeops`

library(mlr3) library(mlr3learners) task1 = tsk("iris") g1 = LearnerClassifRpart$new() %>>% PipeOpRandomResponse$new() g1$train(task1)#> $randomresponse.output #> NULL #>#> $randomresponse.output #> <PredictionClassif> for 150 observations: #> row_id truth response #> 1 setosa setosa #> 2 setosa setosa #> 3 setosa setosa #> --- #> 148 virginica virginica #> 149 virginica virginica #> 150 virginica virginica #>#> $randomresponse.output #> NULL #>#> $randomresponse.output #> <PredictionRegr> for 32 observations: #> row_id truth response #> 1 21.0 23.76570 #> 2 21.0 21.28602 #> 3 22.8 27.52332 #> --- #> 30 19.7 16.99001 #> 31 15.0 13.88306 #> 32 21.4 22.80808 #>