Learn R Programming

mlr (version 2.19.1)

getTaskTargets: Get target data of task.

Description

Get target data of task.

Usage

getTaskTargets(task, recode.target = "no")

Value

A factor for classification or a numeric for regression, a data.frame of logical columns for multilabel.

Arguments

task

(Task)
The task.

recode.target

(character(1))
Should target classes be recoded? Supported are binary and multilabel classification and survival. Possible values for binary classification are “01”, “-1+1” and “drop.levels”. In the two latter cases the target vector is converted into a numeric vector. The positive class is coded as “+1” and the negative class either as “0” or “-1”. “drop.levels” will remove empty factor levels in the target column. In the multilabel case the logical targets can be converted to factors with “multilabel.factor”. For survival, you may choose to recode the survival times to “left”, “right” or “interval2” censored times using “lcens”, “rcens” or “icens”, respectively. See survival::Surv for the format specification. Default for both binary classification and survival is “no” (do nothing).

See Also

Other task: getTaskClassLevels(), getTaskCosts(), getTaskData(), getTaskDesc(), getTaskFeatureNames(), getTaskFormula(), getTaskId(), getTaskNFeats(), getTaskSize(), getTaskTargetNames(), getTaskType(), subsetTask()

Examples

Run this code
task = makeClassifTask(data = iris, target = "Species")
getTaskTargets(task)

Run the code above in your browser using DataLab