Learn R Programming

cases (version 0.1.1)

compare: Compare predictions and labels

Description

Compare predictions and labels

Usage

compare(
  predictions,
  labels,
  partition = TRUE,
  names = c(specificity = 0, sensitivity = 1)
)

Value

data matrix with values 1 (correct prediction) and 0 (false prediction)

Arguments

predictions

integer, predicted class

labels

integer, true class state (reference standard)

partition

logical, should result be split into one matrix per class (TRUE; default) or not (FALSE)

names

integer (named), values give data values, names give class names

Examples

Run this code
pred <- matrix(c(1,1,0), 5, 3)
labels <- c(1, 1, 0, 0, 1)
compare(pred, labels, FALSE)
compare(pred, labels, TRUE)

Run the code above in your browser using DataLab