Original Source Here

# Confusion matrix and Cyber Crime

**What is a Confusion Matrix?**

The confusion matrix gives very fruitful information about the predicted performance of the estimator or model that use in machine learning. Let’s see a confusion matrix.

**What is inside the confusion matrix?**

Actual values are true binary values “0” and”1″. The prediction value that comes after fitting the model is also confusing because it is not predicted all values properly. So, these four terms are born to know the evaluation performance.

Let’s decipher the matrix:

· The target variable has two values: Positive or Negative

· The columns represent the actual values of the target variable

· The rows represent the predicted values of the target variable

**Understanding True Positive, True Negative, False Positive and False Negative in a Confusion Matrix**

We can obtain four different combinations from the predicted and actual values of a classifier:

· **True Positive(TP):** The number of times our actual positive values are equal to the predicted positive. You predicted a positive value, and it is correct.

· The predicted value matches the actual value

· The actual value was positive and the model predicted a positive value

· **True Negative(TN):** The number of times our actual negative values are equal to predicted negative values. You predicted a negative value, and it is actually negative.

· The predicted value matches the actual value

· The actual value was negative and the model predicted a negative value.

· **False Positive(FP): — Type 1 error.**

The number of times our model wrongly predicts negative values as positives. You predicted a negative value, and it is actually positive.

· The predicted value was falsely predicted

· The actual value was negative but the model predicted a positive value

· Also known as the Type 1 error

· **False Negative(FN):** **Type 2 error**

The number of times our model wrongly predicts negative values as positives. You predicted a negative value, and it is actually positive.

· The predicted value was falsely predicted

· The actual value was positive but the model predicted a negative value

· Also known as the Type 2 error.

**Accuracy and Components of Confusion Matrix**

To find how accurate our model is, we use the following metrics:

**Precision:**Precision is used to calculate the model’s ability to classify positive values correctly. It is the true positives divided by the total number of predicted positive values.

**Accuracy:**Accuracy is used to find the portion of correctly classified values. It tells us how often our classifier is right. It is the sum of all true values divided by total values.

**Recall:**It is used to calculate the model’s ability to predict positive values. It is the true positives divided by the total number of actual positive values.

**F1-Score:**It is the harmonic mean of Recall and Precision. It is useful when you need to take both Precision and Recall into account.

The basic definitions for Regression and classification we use in machine learning for confusion matrix.

**Regression:**

Regression (or prediction) is simple. The knowledge about the existing data is utilized to have an idea of the new data. Take an example of house prices prediction. In cybersecurity, it can be applied to fraud detection. The features (e.g., the total amount of suspicious transaction, location, etc.) determine a probability of fraudulent actions.

**Classification:**

Classification is also straightforward. Imagine you have two piles of pictures classified by type (e.g., dogs and cats). In terms of cybersecurity, a spam filter separating spams from other messages can serve as an example. Spam filters are probably the first ML approach applied to Cybersecurity tasks.

AI/ML

Trending AI/ML Article Identified & Digested via Granola by Ramsey Elbasheer; a Machine-Driven RSS Bot