Impute Features by their ModeSource:
Impute features by their mode. Supports factors as well as logical and numerical features. If multiple modes are present then imputed values are sampled randomly from them.
Identifier of resulting object, default
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 (column-wise) mode.
$state is a named
list with the
$state elements inherited from
$state$model is a named
list of a vector of length one of the type of the feature, indicating the mode of the respective feature.
The parameters are the parameters inherited from
Features that are entirely
NA are imputed as
the following: For
ordered, random levels are sampled uniformly at random.
FALSE are sampled uniformly at random.
Numerics and integers are imputed as
Note that every random imputation is drawn independently, so different values may be imputed if multiple values are missing.
Other Imputation PipeOps:
library("mlr3") task = tsk("pima") task$missings() #> diabetes age glucose insulin mass pedigree pregnant pressure #> 0 0 5 374 11 0 0 35 #> triceps #> 227 po = po("imputemode") new_task = po$train(list(task = task))[] new_task$missings() #> diabetes age pedigree pregnant glucose insulin mass pressure #> 0 0 0 0 0 0 0 0 #> triceps #> 0 po$state$model #> $age #>  22 #> #> $glucose #>  100 99 #> #> $insulin #>  105 #> #> $mass #>  32 #> #> $pedigree #>  0.254 0.258 #> #> $pregnant #>  1 #> #> $pressure #>  70 #> #> $triceps #>  32 #>