statsFromConfusionMatrix {heuristica} | R Documentation |
Accuracy, sensitivity, specificity, and precision of 2x2 confusion matrix.
Description
In heuristica, "positive" means the row1 > row2. Other heuristica create confusion matrices with the expected layout, but below is documentation of that layout. A package like 'caret' offers a more general-purpose confusion matrix.
Usage
statsFromConfusionMatrix(confusion_matrix)
Arguments
confusion_matrix |
A 2x2 confusion matrix. |
Details
This assumes the input matrix is 2x2 and will STOP if not. It also assumes negatives are left and higher, and predictions are the rows, that is: true negative [-1,-1] false negative [-1,1] false negative [1, -1] true positive [1, 1]
The outputs are defined as: accuracy = (true positive + true negative) / all sensitivity = true positive rate = true positive / all positive (sensitivity is also called recall) specificity = true negative rate = true negative / all negative precision = positive predictive value = true positive
Value
A list with accuracy, sensitivity, specificity, and precision