Original Source Here

Every time when we create a classification model, it is very difficult for us to check accuracy of model by output data as we as a humans are prefer visuals instead of data and to overcome this problem classification have a tool known as confusion matrix.

Confusion matrix is mainly calculated in classification problems. It gives us insight how our model is working. Using confusion matrix we can visualize how many datasets from each feature got predicted correctly.

Confusion matrix contains 4 values

## · True Positives

When our actual answer is positive and models also predicts positive

## · True Negative

When our actual answer is negative and models also predicts negative

## · False Positives

When our actual answer is positive but model predicts negative

## · False Negative

When our actual answer is positive but model predicts positive.

Let us understand these four terms with the help of an example

Let us consider 4 friends in a class, they created a machine learning model to predict their result according to their study hours.

In this example we saw that

· A is True Positive as the actual result and predicted result both have positive value.

· B is False Negative as the actual result is positive but the model predicts negative result.

· C is False Positive as the actual result is negative but the model predicts positive result.

· D is True Negative as the actual result and predicted result both have negative value.

**Accuracy and Precision**

Accuracy score is total number of true predictions i.e.,

(Actual Value = Predicted Value)

Accuracy of a model is accuracy score divided by total number of predictions.

**Types of Errors in Confusion Matrix**

*Type 1 Error*

*Type 2 Error*

**False Positives (FP-Type 1 error)**

Type 1 error or False Positives means where our actual value is negative but our predicted value is positive.

**False Negatives (FN-Type 2 error)**

Type 1 error or False negative means where our actual value is positive but our predicted value is negative.

Let’s understand why type-1 Error is not OK ?

Let us consider any security system installed in our OS.

1. The security system is alarming your system is in danger but accurately our system is not in danger.

2. The security system is not alarming but someone is breaching our OS.

We have two outputs of our security system, first is false negative (type-1 error) and second is false positive (type-2 error)

For first condition(type-2 error) we are OK because as our system is alarming for threat but accurately our system is safe but for condition 2(type-1 error) in spite of our system is in threat but security system is not alarming.

Therefore, type 1 error is much more dangerous in comparison with type 2 error.

Thankyou for reading

AI/ML

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