Skip to contents

This function returns the outcome of a confusion matrix in a list.

Usage

confusion_matrix_outcomes(true, pred, confusion = NULL, positive = 0)

Arguments

true

a vector (or a matrix) of observed values. If a matrix is provided, a multi-response is assumed

pred

a vector (or a matrix) of predicted values

confusion

a confusion matrix as returned by confusion_matrix. If confusion is not provided, a confusion matrix is internally computed by using true and pred

positive

integer or character indicating the target class. If positive = 0 (default), global values are computed.

Value

a list containing the number of false positives (FP), false negatives (FN), true positives (TP), and true negatives (TN) of a confusion matrix.

Details

The outcomes of a confusion matrix are returned as elements of a list. The four possible outcomes are:

TP

true positives, when the actual presence of a condition is correctly predicted

TN

true negatives, when the actual absence of a condition is correctly predicted

FP

false positives, when the actual absence of a condition is wrongly predicted

FN

false negatives, when the actual presence of a condition is wrongly predicted

Author

Alessandro Barberis