Confusion Matrix

Shruti Choudhary
3 min readJun 5, 2021

Classification is a supervised learning approach in which a target variable is discrete (or categorical). Evaluating a machine learning model is as important as building it. We are creating models to perform on new, previously unseen data. Hence, a thorough and versatile evaluation is required to create a robust model. When it comes to classification models, evaluation process gets somewhat tricky.

What is Confusion Matrix?

A Confusion matrix is an N x N matrix used for evaluating the performance of a classification model, where N is the number of target classes. The matrix compares the actual target values with those predicted by the machine learning model.

True Positive:

It shows that the predicted values are correctly predicted as actual positive.

False Positive:

It shows that predicted values are incorrectly predicted as an actual positive. i.e., negative values are predicted as positive. It is also known as Type -1 error.

False Negative:

It shows positive values that are predicted as negative. It is also known as Type — 2 error.

True Negative:

It shows that the predicted values are correctly predicted as an actual negative.

Confusion matrices have two types of errors: Type I and Type II.

The first way is to re-write False Negative and False Positive. False Positive is a Type I error because False Positive = False True and that only has one F. False Negative is a Type II error because False Negative = False False so thus there are two F’s making it a Type II. (Kudos to Riley Dallas for this method!)

The second way is to consider the meanings of these words. False Positive contains one negative word (False) so it’s a Type I error. False Negative has two negative words (False + Negative) so it’s a Type II error.

Cybercrime is criminal activity that either targets or uses a computer, a computer network or a networked device.

Most, but not all, cybercrime is committed by cybercriminals or hackers who want to make money. Cybercrime is carried out by individuals or organizations.

Some cybercriminals are organized, use advanced techniques and are highly technically skilled. Others are novice hackers.

Rarely, cybercrime aims to damage computers for reasons other than profit. These could be political or personal.

Here are some specific examples of the different types of cybercrime:

  • Email and internet fraud.
  • Identity fraud (where personal information is stolen and used).
  • Theft of financial or card payment data.
  • Theft and sale of corporate data.
  • Cyberextortion (demanding money to prevent a threatened attack).
  • Ransomware attacks (a type of cyberextortion).
  • Cryptojacking (where hackers mine cryptocurrency using resources they do not own).
  • Cyberespionage (where hackers access government or company data).

The target of the machine learning classification model:

In this scenario, the machine learning model informs the organization about the cyber attack on their system so they can soon take immediate action .The machine learning model was trained using a past cyberattack dataset. In the dataset, information is of what changes happened at the system after the cyber attack happened on the system

Thanks for reading !!

--

--

Shruti Choudhary

MLOps | Docker | Kubernetes | python | AWS | flutter