cpoSelector: CPO that Selects Features

cpoSelectorR Documentation

CPO that Selects Features

Description

CPO that Selects Features

Usage

cpoSelector(
  selection,
  id,
  export = "export.default",
  affect.type = NULL,
  affect.index = integer(0),
  affect.names = character(0),
  affect.pattern = NULL,
  affect.invert = FALSE,
  affect.pattern.ignore.case = FALSE,
  affect.pattern.perl = FALSE,
  affect.pattern.fixed = FALSE
)

Arguments

selection

[logical]
Logical vector indicating if a features was selected or not. Must have the same length as number of features.

id

[character(1)]
id to use as prefix for the CPO's hyperparameters. this must be used to avoid name clashes when composing two CPOs of the same type, or with learners or other CPOS with hyperparameters with clashing names.

export

[character]
Either a character vector indicating the parameters to export as hyperparameters, or one of the special values “export.all” (export all parameters), “export.default” (export all parameters that are exported by default), “export.set” (export all parameters that were set during construction), “export.default.set” (export the intersection of the “default” and “set” parameters), “export.unset” (export all parameters that were not set during construction) or “export.default.unset” (export the intersection of the “default” and “unset” parameters). Default is “export.default”.

affect.type

[character | NULL]
Type of columns to affect. A subset of “numeric”, “factor”, “ordered”, “other”, or NULL to not match by column type. Default is NULL.

affect.index

[numeric]
Indices of feature columns to affect. The order of indices given is respected. Target column indices are not counted (since target columns are always included). Default is integer(0).

affect.names

[character]
Feature names of feature columns to affect. The order of names given is respected. Default is character(0).

affect.pattern

[character(1) | NULL]
grep pattern to match feature names by. Default is NULL (no pattern matching)

affect.invert

[logical(1)]
Whether to affect all features not matched by other affect.* parameters.

affect.pattern.ignore.case

[logical(1)]
Ignore case when matching features with affect.pattern; see grep. Default is FALSE.

affect.pattern.perl

[logical(1)]
Use Perl-style regular expressions for affect.pattern; see grep. Default is FALSE.

affect.pattern.fixed

[logical(1)]
Use fixed matching instead of regular expressions for affect.pattern; see grep. Default is FALSE.

Value

[CPO]

Examples

library("mlr")
library("mlrCPO")

# Dataset has originally four features
iris.task$task.desc$n.feat

iris.task.subset = iris.task %>>% cpoSelector(c(TRUE, TRUE, FALSE, FALSE))

# Now only two were selected
iris.task.subset$task.desc$n.feat

mosmafs documentation built on Nov. 3, 2022, 1:05 a.m.