Impute features by a constant value.
R6Class object inheriting from
PipeOpImputeConstant$new(id = "imputeconstant", param_vals = list())
Identifier of resulting object, default
param_vals :: named
List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default
Input and output channels are inherited from
The output is the input
Task with all affected features missing values imputed by
the value of the
$state is a named
list with the
$state elements inherited from
$state$model contains the value of the
constant parameter that is used for imputation.
The parameters are the parameters inherited from
PipeOpImpute, as well as:
The constant value that should be used for the imputation, atomic vector of length 1. The atomic mode must match the type of the features that will be selected by the
parameter and this will be checked during imputation. Initialized to
Should be checked whether the
constant value is a valid level of factorial features (i.e., it
already is a level)? Raises an error if unsuccesful. This check is only performed for factorial
ordered; skipped for
character). Initialized to
Adds an explicit new level to
ordered features, but not to
FALSE and the level is not already present.
Only methods inherited from
Other Imputation PipeOps:
library("mlr3") task = tsk("pima") task$missings() # impute missing values of the numeric feature "glucose" by the constant value -999 po = po("imputeconstant", param_vals = list( constant = -999, affect_columns = selector_name("glucose")) ) new_task = po$train(list(task = task))[] new_task$missings() new_task$data(cols = "glucose")[]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.