Page 301 - Ai Book - 10
P. 301
CONFUSION MATRIX
A confusion matrix is a N*N matrix used for evaluating the performance of the model on the basis of two
parameters: Prediction and Reality. It is useful because direct comparisons of values such as True Positive, False
Positive, True Negative and False Negative would be achieved. Let us draw a confusion matrix for the given
examples of flood:
Knowledge Botwledge Bot
Kno
Confusion matrix is also known as the Error Matrix and is used in situations where we need to evaluate
the performance of the model, where it went wrong and helps us in finding the ways to increase the
efficiency of the model.
In simple words, a confusion matrix is a summary of prediction results. Thus, it plays an important role in model
evaluation.
In the Confusion Matrix:
u The target variable has two values. Positive and Negative.
u The columns represent actual values of the target variable.
u The rows represent the predicted values of the target variable.
Terminologies of Confusion Matrix
To understand the confusion matrix, let’s understand the following terms:
u Positive: The prediction is positive for the scenario. For example, there will be board exams.
u Negative: The prediction is negative for the scenario. For example, there will be no board exams conducted
this year.
u True Positive: The predicted value matches the actual value, i.e.; the actual value was positive and the
model predicted a positive value.
u True Negative: The predicted value matches the actual value, i.e.; the actual value was negative the mode
predicted a negative value.
u False Positive (Type 1 error): The predicted value was falsely predicted, i.e.; the actual value was negative
but the model predicted a positive value.
u False Negative (Type 2 error): The predicted value was falsely predicted, i.e.; the actual value was positive
but the model predicted a negative value.
175
175