Impute factorial features by adding a new feature.

Format

R6Class object inheriting from PipeOpImpute/PipeOp.

Construction

PipeOpImputeNewlvl$new(id = "imputenewlvl", param_vals = list())
  • id :: character(1)
    Identifier of resulting object, default "imputenewlvl".

  • param_vals :: named list
    List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default list().

Input and Output Channels

Input and output channels are inherited from PipeOpImputeNewlvl.

The output is the input Task with all affected factorial features missing values imputed by a new level.

State

The $state is a named list with the $state elements inherited from PipeOpImpute.

The $state$model contains only NULL elements.

Parameters

The parameters are the parameters inherited from PipeOpImpute.

Internals

Adds an explicit new level() to factor and ordered features, but not to character features.

Methods

Only methods inherited from PipeOpImpute/PipeOp.

See also

Examples

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("imputenewlvl") new_task = po$train(list(task = task))[[1]] new_task$missings()
#> diabetes age glucose insulin mass pedigree pregnant pressure #> 0 0 5 374 11 0 0 35 #> triceps #> 227