Data Science Jumpstart with 10 Projects Transcripts
Chapter: Project 8: Predicting Heart Disease with Machine Learning
Lecture: Using a Confusion matrix to Understand the Model

Login or purchase this course to watch this video and the rest of the course contents.
0:00 In this section I'm going to look at a confusion matrix to try and understand how our model is performing.
0:05 So confusion matrix looks something like this. At the bottom you have the predicted label and along the side you have the true label.
0:15 So this is our stepwise tuned model. What we want to see is along the diagonal here that we have a lot of dark values.
0:23 You can see that for predictions of 4 it didn't do very well. It seems to do pretty well for predictions of 0.
0:32 How do we interpret this prediction of 4? Well you can see that three of those are predicted as 3, one of them is predicted as 2,
0:40 and three of them are predicted as 1. So it didn't predict anything as 4. You can see for 0 it did a pretty good job
0:49 of predicting 0. Of the ones that were 0 that weren't, 12 of them were predicted as 1 and 4 of them were predicted as 2.
0:58 Now let's look at this with the training data. Here's what it looks like with the training data. So with the training data
1:05 it did actually get a 1 here, but it does have some misclassifications there. Let's compare this with our out-of-the-box model.
1:14 Here's our out-of-the-box model. Let's just look at this 89, 26, 10, and 9. 87, 26, 10, and 9. So you can see like for example
1:26 our model is doing better with predicting label 1, but it's doing a little bit worse on the other labels. If you look at the training data you
1:35 can see that it matches up along the diagonal. It looks like if we want to optimize label 1 we should use our step tuned model
1:44 because that does a better job of predicting 1 than the other model.


Talk Python's Mastodon Michael Kennedy's Mastodon