Chunks its input into outnum chunks. Creates outnum Tasks during training, and simply passes on the input during outnum times during prediction.

Format

R6Class object inheriting from PipeOp.

Construction

PipeOpChunk$new(outnum, id = "chunk", param_vals = list())
  • outnum :: numeric(1)
    Number of output channels, and therefore number of chunks created.

  • id :: character(1)
    Identifier of resulting object, default "chunk".

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

Input and Output

PipeOpChunk has one input channel named "input", taking a Task both during training and prediction.

PipeOpChunk has multiple output channels depending on the options construction argument, named "output1", "output2", ... All output channels produce (respectively disjoint, random) subsets of the input Task during training, and pass on the original Task during prediction.

State

The $state is left empty (list()).

Parameters

  • shuffle :: logical(1)
    Should the data be shuffled before chunking? Initialized to TRUE.

Internals

Uses the mlr3misc::chunk_vector() function.

Fields

Only fields inherited from PipeOp.

Methods

Only methods inherited from PipeOp.

See also

Examples

library("mlr3") task = tsk("wine") opc = mlr_pipeops$get("chunk", 2) # watch the row number: 89 during training (task is chunked)... opc$train(list(task))
#> $output1 #> <TaskClassif:wine> (89 x 14) #> * Target: type #> * Properties: multiclass #> * Features (13): #> - dbl (11): alcalinity, alcohol, ash, color, dilution, flavanoids, #> hue, malic, nonflavanoids, phenols, proanthocyanins #> - int (2): magnesium, proline #> #> $output2 #> <TaskClassif:wine> (89 x 14) #> * Target: type #> * Properties: multiclass #> * Features (13): #> - dbl (11): alcalinity, alcohol, ash, color, dilution, flavanoids, #> hue, malic, nonflavanoids, phenols, proanthocyanins #> - int (2): magnesium, proline #>
# ... 178 during predict (task is copied) opc$predict(list(task))
#> $output1 #> <TaskClassif:wine> (178 x 14) #> * Target: type #> * Properties: multiclass #> * Features (13): #> - dbl (11): alcalinity, alcohol, ash, color, dilution, flavanoids, #> hue, malic, nonflavanoids, phenols, proanthocyanins #> - int (2): magnesium, proline #> #> $output2 #> <TaskClassif:wine> (178 x 14) #> * Target: type #> * Properties: multiclass #> * Features (13): #> - dbl (11): alcalinity, alcohol, ash, color, dilution, flavanoids, #> hue, malic, nonflavanoids, phenols, proanthocyanins #> - int (2): magnesium, proline #>