Shubh Kohli
3 min readJun 6, 2021

What is confusion matrix and why it is used?

A confusion matrix is a technique for summarizing the performance of a classification algorithm. Classification accuracy alone can be misleading if you have an unequal number of observations in each class or if you have more than two classes in your dataset. Confusion matrices are useful because they give direct comparisons of values like True Positives, False Positives, True Negatives and False Negatives.

Confusion matrices are widely used because they give a better idea of a model’s performance than classification accuracy does. The Confusion matrix has 4 parameters:

  • True Positives (TP): when the actual value is Positive and predicted is also Positive.
  • True negatives (TN): when the actual value is Negative and prediction is also Negative.
  • False positives (FP): When the actual is negative but prediction is Positive. Also known as the Type 1 error.
  • False negatives (FN): When the actual is Positive but the prediction is Negative. Also known as the Type 2 error.

FOR EXAMPLE:

  • here are two possible predicted classes: “yes” and “no”. If we were predicting the presence of a disease, for example, “yes” would mean they have the disease, and “no” would mean they don’t have the disease.
  • The classifier made a total of 165 predictions (e.g., 165 patients were being tested for the presence of that disease).
  • Out of those 165 cases, the classifier predicted “yes” 110 times, and “no” 55 times.
  • In reality, 105 patients in the sample have the disease, and 60 patients do not.
  • Accuracy: Overall, how often is the classifier correct

(TP+TN)/total = (100+50)/165 = 0.91

0.91 X 100 = 91%

This is how we can use Confusion Matrix to check the accuracy of our model.

What is cyber security?

Cyber security is the application of technologies, processes and controls to protect systems, networks, programs, devices and data from cyber attacks. It aims to reduce the risk of cyber attacks and protect against the unauthorised exploitation of systems, networks and technologies.

How confusion Matrix and Cyber security are related?

Most of the cyber crimes takes place due to Type 1 error. Any Hacker tries to break our system and gets it, but our system still show everything positive. In reality it is negative but due to type 1 error it is showing positive. So this can result in loss of personal data. That’s why type 1 error is most dangerous error.

Thanks for reading!

Shubh Kohli
Shubh Kohli

No responses yet