Extracts statistically independent components from data. Only affects numerical features. See fastICA::fastICA for details.

Format

R6Class object inheriting from PipeOpTaskPreproc/PipeOp.

Construction

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

  • 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 PipeOpTaskPreproc.

The output is the input Task with all affected numeric parameters replaced by independent components.

State

The $state is a named list with the $state elements inherited from PipeOpTaskPreproc, as well as the elements of the "fastICA" function, with the exception of the $X and $S slots. These are in particular:

  • K :: matrix
    Matrix that projects data onto the first n.comp principal components. See fastICA().

  • W :: matrix
    Estimated un-mixing matrix. See fastICA().

  • A :: matrix
    Estimated mixing matrix. See fastICA().

  • center :: numeric
    The mean of each numeric feature during training.

Parameters

The parameters are the parameters inherited from PipeOpTaskPreproc, as well as the following parameters based on fastICA():

  • n.comp :: numeric(1)
    Number of components to extract. Default is NULL, which sets it to the number of available numeric columns.

  • alg.typ:: character(1)
    Algorithm type. One of “parallel” (default) or “deflation”.

  • fun :: character(1)
    One of “logcosh” (default) or “exp”.

  • alpha :: numeric(1)
    In range [1, 2], Used for negentropy calculation when fun is “logcosh”. Default is 1.0.

  • method :: character(1)
    Internal calculation method. “C” (default) or “R”. See fastICA().

  • row.norm :: logical(1)
    Logical value indicating whether rows should be standardized beforehand. Default is FALSE.

  • maxit :: numeric(1)
    Maximum number of iterations. Default is 200.

  • tol :: numeric(1)
    Tolerance for convergence, default is 1e-4.

  • verbose logical(1)
    Logical value indicating the level of output during the run of the algorithm. Default is FALSE.

  • w.init:: matrix
    Initial un-mixing matrix. See fastICA(). Default is NULL.

Internals

Uses the fastICA() function.

Methods

Only methods inherited from PipeOpTaskPreproc/PipeOp.

See also

Examples

library("mlr3") task = tsk("iris") pop = po("ica") task$data()
#> Species Petal.Length Petal.Width Sepal.Length Sepal.Width #> 1: setosa 1.4 0.2 5.1 3.5 #> 2: setosa 1.4 0.2 4.9 3.0 #> 3: setosa 1.3 0.2 4.7 3.2 #> 4: setosa 1.5 0.2 4.6 3.1 #> 5: setosa 1.4 0.2 5.0 3.6 #> --- #> 146: virginica 5.2 2.3 6.7 3.0 #> 147: virginica 5.0 1.9 6.3 2.5 #> 148: virginica 5.2 2.0 6.5 3.0 #> 149: virginica 5.4 2.3 6.2 3.4 #> 150: virginica 5.1 1.8 5.9 3.0
pop$train(list(task))[[1]]$data()
#> Species V1 V2 V3 V4 #> 1: setosa 0.37511819 -0.2614671 0.03018948 -1.3924091 #> 2: setosa -0.97204316 -0.3863113 -0.08150587 -1.3294709 #> 3: setosa -0.34917329 0.3569324 -0.15918406 -1.3493128 #> 4: setosa -0.38051288 0.8804632 0.31157631 -1.2048880 #> 5: setosa 0.73625121 0.2004625 0.10861588 -1.3728185 #> --- #> 146: virginica -0.31427679 -1.2722557 -2.59248369 0.8284959 #> 147: virginica -1.35965251 -0.7281463 -1.05463380 0.7567271 #> 148: virginica 0.09390697 -0.3435600 -0.98349706 0.8274927 #> 149: virginica 1.39454821 1.2488082 -1.76965367 1.0478893 #> 150: virginica 0.57230248 1.5514909 0.04158748 0.8750616
pop$state
#> $K #> [,1] [,2] [,3] [,4] #> [1,] -0.4180098 0.3531217 -0.2735163 -3.118456 #> [2,] -0.1748261 0.1537381 -1.9583093 4.897992 #> [3,] -0.1763375 -1.3373258 2.0881803 2.050340 #> [4,] 0.0412425 -1.4871770 -2.1451574 -2.077869 #> #> $W #> [,1] [,2] [,3] [,4] #> [1,] -0.06941974 0.1453280 -0.012370640 -0.98686759 #> [2,] -0.79828984 0.5852154 0.002391824 0.14230446 #> [3,] -0.47949497 -0.6399816 0.596561024 -0.06799358 #> [4,] -0.35776919 -0.4762629 -0.802468810 -0.03490948 #> #> $A #> [,1] [,2] [,3] [,4] #> [1,] 0.09053046 0.05284972 0.21360134 0.37166291 #> [2,] -0.15656998 -0.04288891 -0.42322950 -0.05453389 #> [3,] 0.06849478 -0.17464600 0.06621392 -0.06294083 #> [4,] 1.74874275 0.73620589 0.67230142 -0.20891165 #> #> $center #> Petal.Length Petal.Width Sepal.Length Sepal.Width #> 3.758000 1.199333 5.843333 3.057333 #> #> $dt_columns #> [1] "Petal.Length" "Petal.Width" "Sepal.Length" "Sepal.Width" #> #> $affected_cols #> [1] "Petal.Length" "Petal.Width" "Sepal.Length" "Sepal.Width" #> #> $intasklayout #> id type #> 1: Petal.Length numeric #> 2: Petal.Width numeric #> 3: Sepal.Length numeric #> 4: Sepal.Width numeric #> #> $outtasklayout #> id type #> 1: V1 numeric #> 2: V2 numeric #> 3: V3 numeric #> 4: V4 numeric #>