Understanding Confusion Matrix
Understanding Confusion Matrix
In Machine learning, confusion matrix is often created to describe the performance of the classifier or the classification model .It is a table that is created in a set of test data for which the true values are known. Confusion matrix on its own is simple, but terminology is a bit confusing. Classification can be either Binary or Multiclass. Here, we will deal with binary classification for the sake of ease of understanding.
There are a lot information that can be learned from a confusion matrix. In the present Scenario, there are two predicted classes “YES” and “NO”. “. If the scenario is checking for the presence of a disease, for example, “YES” would mean they have the disease, and “NO” would mean they don’t have the disease. In this case, classifier model has made 165 predictions, out of which, classifier predicted “YES” 110 times and “NO” 55 times. In actuality, 105 patients have disease and 60 patients do not.
The primary building blocks of the metrics that we will use to evaluate classification models are the following:
True positives (TP): These are cases in which we predicted they have the disease, and they actually do have the disease.
True negatives (TN): It is predicted no, and they don’t have the disease.
False positives (FP):It is predicted yes, but in actuality, they don’t have the disease. It is also known as a “Type I error.”
False negatives (FN): It is predicted no, but in actuality, they do have the disease. It is also known as a “Type II error.”
The following rates can be often computed from a confusion matrix for a binary classifier:
Accuracy: explains how often is the classifier correct?
(TP+TN)/total = (100+50)/165 = 0.91
Misclassification Rate or Error Rate: explains how often it is wrong?
(FP+FN)/total = (10+5)/165 = 0.09
It is Equivalent to 1 minus Accuracy
True Positive Rate or Sensitivity or Recall: When it’s actually yes, how often does it predict yes?
TP/actual yes = 100/105 = 0.95
False Positive Rate: When it’s actually no, how often does it predict yes?
FP/actual no = 10/60 = 0.17
True Negative Rate or Specificity: When it’s actually no, describes how often does it predict no?
TN/actual no = 50/60 = 0.83
It is equivalent to 1 minus False Positive Rate.
Precision: Describes how accurately prediction is done?
TP/predicted yes = 100/110 = 0.91
Prevalence: Describes how often the yes condition actually does occur in our sample?
actual yes/total = 105/165 = 0.64
Choosing the best AI training in Kochi is a must to have good basics in python and its related packages so as to learn the huge collection of machine learning algorithms and other relevant topics. Let’s not wait and grab the opportunity to learn AI in Kochi now.