Task to use a fraction of the rows.
PipeOpSubsample$new(id = "subsample", 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
Input and output channels are inherited from
The output during training is the input
Task with added or removed rows according to the sampling.
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:
Fraction of rows in the
Task to keep. May only be greater than 1 if
TRUE. Initialized to
(1 - exp(-1)) == 0.6321.
Should the subsamples be stratified by target? Initialized to
FALSE. May only be
Sample with replacement? Initialized to
task$filter() to remove rows. If
TRUE and identical rows are added, then the
task$row_roles$use can not be used
to duplicate rows because of [inaudible]; instead the
task$rbind() function is used, and
data.table is attached that contains all rows that are being duplicated exactly as many times as they are being added.
library("mlr3") pos = mlr_pipeops$get("subsample", param_vals = list(frac = 0.7, stratify = TRUE)) pos$train(list(tsk("iris"))) #> $output #> <TaskClassif:iris> (105 x 5) #> * Target: Species #> * Properties: multiclass #> * Features (4): #> - dbl (4): Petal.Length, Petal.Width, Sepal.Length, Sepal.Width #>