111k views
4 votes
How to calculate accuracy precision and recall from confusion matrix

User Todd Curry
by
8.2k points

1 Answer

2 votes

Final answer:

To calculate accuracy, precision, and recall from a confusion matrix, you need to understand the different elements of the matrix and their meanings. Accuracy is calculated using the formula (TP + TN) / (TP + TN + FP + FN). Precision is calculated using the formula TP / (TP + FP). Recall is calculated using the formula TP / (TP + FN).

Step-by-step explanation:

To calculate accuracy, precision, and recall from a confusion matrix, you need to understand the different elements of the matrix and their meanings:


  • True positive (TP) represents the number of correct positive predictions.

  • False positive (FP) represents the number of incorrect positive predictions.

  • True negative (TN) represents the number of correct negative predictions.

  • False negative (FN) represents the number of incorrect negative predictions.


To calculate accuracy:

Accuracy = (TP + TN) / (TP + TN + FP + FN)

To calculate precision:

Precision = TP / (TP + FP)

To calculate recall:

Recall = TP / (TP + FN)

Remember to substitute the appropriate values into the formulas to obtain the accurate measures.

User Peter Boone
by
8.3k points