Skip to contents

Replace all factor features with their dummy variables. Internally model.matrix is used. Non factor features will be left untouched and passed to the result.

Usage

createDummyFeatures(
  obj,
  target = character(0L),
  method = "1-of-n",
  cols = NULL
)

Arguments

obj

(data.frame | Task)
Input data.

target

(character(1) | character(2) | character(n.classes))
Name(s) of the target variable(s). Only used when obj is a data.frame, otherwise ignored. If survival analysis is applicable, these are the names of the survival time and event columns, so it has length 2. For multilabel classification these are the names of logical columns that indicate whether a class label is present and the number of target variables corresponds to the number of classes.

method

(character(1))
Available are:

"1-of-n":

For n factor levels there will be n dummy variables.

"reference":

There will be n-1 dummy variables leaving out the first factor level of each variable.

Default is “1-of-n”.

cols

(character)
Columns to create dummy features for. Default is to use all columns.

Value

data.frame | Task. Same type as obj.