Page 217 - Ai_417_V3.0_C9_Flipbook
P. 217

Confusion Matrix


                 Confusion matrix is a tabular structure that helps in measuring the performance of an AI model using the test data.
                 The table is made with 4 different combinations of predicted and actual values (reality) in the form of a 2×2 matrix.
                 The comparison between the prediction and the reality can be used to analyse the rate of success. It also gives a
                 clear picture of which cases are being predicted correctly and incorrectly, and what types of errors are being made.

                 This 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 find ways to increase the efficiency of the model. It is useful for
                 measuring recall, precision, accuracy and F1 score.
                 The following confusion matrix table illustrates how the 4-classification metrics are calculated (TP, FP, FN, TN), and
                 how our predicted value is compared to the actual value in a confusion matrix.

                                                                                           Reality
                                   Confusion Matrix
                                                                                Yes                      No

                                                       Yes                True Positive (TP)      False Positive (FP)
                          Prediction
                                                       No               False Negative (FN)       True Negative (TN)

                 In the confusion matrix:

                    • The target variable has two values: Positive and Negative.
                    • The columns represent the actual values of the target variable.
                    • The rows represent the predicted values of the target variable.

                 For example:

                 In schools, a lot of times it happens that there is no transport facility available to commute. The unavailability of
                 school transport is a very common and prominent problem. Hence, an AI model is designed to predict if there is
                 going to be school transport available or not.

                 The confusion matrix for the same is:

                                                                                           Reality
                                   Confusion Matrix
                                                                                Yes                      No
                                                       Yes                      22                       12
                          Prediction
                                                       No                       48                       18


                                Reboot

                      1.   Differentiate between prediction and reality.




                      2.   What is error matrix?







                                                                         AI Reflection, Project Cycle and Ethics  215
   212   213   214   215   216   217   218   219   220   221   222