Ask Learn Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
The training accuracy of a classification model is much less important than how well that model works when it's given new, unseen data. After all, you train models so that they can be used on new data that you find in the real world. So, after you've trained a classification model, you should evaluate how well it performs on a set of new, unseen data.
Earlier, you created a model that predicts whether a patient has diabetes based on their blood glucose level. Now, if you apply this model to some data that wasn't part of the training set, you get the following predictions:
x | y | ŷ |
---|---|---|
83 | 0 | 0 |
119 | 1 | 1 |
104 | 1 | 0 |
105 | 0 | 1 |
86 | 0 | 0 |
109 | 1 | 1 |
Recall that x refers to blood glucose level, y refers to whether the patient is actually diabetic, and ŷ refers to the model's prediction as to whether the patient is diabetic.
Simply calculating the number of correct predictions is sometimes misleading or too simplistic to help you understand the kinds of errors it will make in the real world. To get more detailed information, you can tabulate the results in a structure called a confusion matrix, as shown here:
The confusion matrix shows the total number of cases where:
The cells in the confusion matrix are often shaded so that higher values have a deeper shade. This makes it easier to see a strong diagonal trend from top-left to bottom-right, highlighting the cells where the predicted value and actual value are the same.
From these core values, you can calculate a range of other metrics that can help you evaluate the performance of the model. For example:
Please sign in to use this experience.
Sign in