Only binary classification Tasks are supported.
Caution: when constructed naively without parameter, the weights are all set to 1. The
must be adjusted for this
PipeOp to be useful.
PipeOpClassWeights$new(id = "classweights", param_vals = list())
Identifier of the resulting object, default
param_vals :: named
List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction. Default
The output during training is the input
Task with added weights column according to target class.
The output during prediction is the unchanged input.
$state is a named
list with the
$state elements inherited from
The parameters are the parameters inherited from
PipeOpTaskPreproc; however, the
affect_columns parameter is not present. Further parameters are:
Weight given to samples of the minor class. Major class samples have weight 1. Initialized to 1.
The newly introduced column is named
.WEIGHTS; there will be a naming conflict if this column already exists and is not a
weight column itself.
#> NULL# double the instances in the minority class (spam) opb$param_set$values$minor_weight = 2 result = opb$train(list(task))[[1L]] result$weights#> row_id weight #> 1: 1 2 #> 2: 2 2 #> 3: 3 2 #> 4: 4 2 #> 5: 5 2 #> --- #> 4597: 4597 1 #> 4598: 4598 1 #> 4599: 4599 1 #> 4600: 4600 1 #> 4601: 4601 1