Classification Matrices
Accuracy
The first metric we take into account is accuracy. Let’s see the formula:
So, accuracy is a measure of how often our ML model is correct in its
predictions.
Precision measures the ability of a classifier to not label as positive a
sample that is negative. In other words, it measures the fraction of true
positives among all positive predictions. Simplifying, precision tells how
accurate are the positive predictions of our model. That’s the formula:
Recall metric that measures the fraction of true positives among all actual
positives. In other words, it measures how many of the actual positives are
correctly predicted. Simplifying, recall tells us how well our model is able
to find all the positive instances in our data. Here’s the formula:
F1-score is an evaluation metric in Machine Learning that combines
precision and recall into a single value in the range 0–1. If f1-score results
in a 0 value, then our ML model has low performance. If f1-score results
in a 1 value, then our ML model has high performance.
The confusion matrix is a table that summarizes the performance of a
classification model by showing the number of true positives, false
positives, true negatives, and false negatives.
In a binary classification problem, the confusion matrix has two rows and
two columns and it’s displayed like so:
We define a True Positive (TP) as a data point belonging to a class
that is predicted to belong to that class. For example, if the model
predicts that an email is spam, and it is indeed spam, then that is a
true positive.
We define a True Negative (TN) as a data point not belonging to a
class that is predicted to not belong to that class. For example, if the
model predicts that an email is not spam, and it is indeed not spam,
then that is a true negative.
We define a False Positive (FP) as a data point belonging to a class
that is predicted to belong to another class. For example, if the
model predicts that an email is spam, but it is actually not spam, then
that is a false positive.
We define a False Negative (FN) as a data point not belonging to a
class that is predicted not to belong to that class. For example, if the
model predicts that an email is not spam, but it is actually spam, then
that is a false negative.