**What is confusion matrix?**

A confusion matrix is a table that is often used to describe the performance of a classification model on a set of test data for which the true values are known.

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.

For a binary classification problem, we would have a 2 x 2 matrix as shown below with 4 values:

- TP: True Positive: Predicted values correctly predicted as actual positive
- FP: Predicted values incorrectly predicted an actual positive. i.e., Negative values predicted as positive
- FN: False Negative: Positive values predicted as negative
- TN: True Negative: Predicted values correctly predicted as an actual negative

**Type 1 error** in machine learning is False Positive and it is most dangerous in real life usecase for example predicting covid result or Cyber Attack.

**Type 2 error** in machine learning is False Negative and it somehow not effect much but type 1 can create lot of problems and heavy loss.

## USECASE — How the confusion matrix helps in the cyber security

**Problem Statement –**

With the exponential increase of social media users, cyberbullying has emerged as a form of bullying through the emails and private message to them.

Hacking is another factor which create leak of personal data and many more harm to the society or individual person.

In this machine learning play important role in predicting the correct decision so that according to it the decision can be taken and reduce the harms as much as possible. To reduce the above problems SVM and Neural Network are the two classifiers can be used.

Generally, the evolution of classifier is done using several evaluation matrices depends on the Confusion Matrix. The accuracy, precision, recall and f-score are the parameters which are very helpful in predicting the real situation happened.

## f-score = 2*precision*recall/precision + recall

Thank you!!!