define_target: Define a target variable

View source: R/define_target.R

define_targetR Documentation

Define a target variable

Description

This function may be used to define a custom evaluation target. Many targets from the Metrics package can be imported directly. Call define_target() for a list of known targets.

Usage

define_target(
  target,
  measure,
  type = c("performance", "error"),
  task = c("classification", "regression"),
  co.primary = c(FALSE, TRUE)
)

Arguments

target

character, giving the name of the performance measure.

measure

function with two arguments (actual, predicted) defining how (dis)similarity between actual and predicted labels is measured. The return value of measure needs to be numeric, even if the prediction is NA.

type

character, either "performance" (higher values indicate better performance, default) or "error" (higher values indicate worse performance)

task

character, either "classification" (default) or "regression"

co.primary

logical: should target be assessed in both subpopulations (only possible for binary "classification" tasks)?

Details

If target is a recognized (e.g. "accuracy"), all other arguments are ignored. If target is missing (default function call), a list of known targets is printed. The only stored target with co.primary = TRUE, is called "sensspec" and corresponds to accessing sensitivity and specificity of a classifier as co-primary endpoints.

Value

An object of class SEPM.objective which is used as the starting point of the further evaluation pipeline. SEPM.objective contains elements target, measure, task and co.primary. In addition, the logical custom indicates if the objective definition was user specific.

Examples

define_target()
tar <- define_target("accuracy")
tar

maxwestphal/SEPM documentation built on April 12, 2024, 12:09 a.m.