types of machine learning the model was correct in ( + cases and incorrect in ( + casesresulting in ( correct/ total observations accuracy all the correctly classified observations are added up on the diagonal ( + while everything else ( + is incorrectly classified when the model only predicts two classes (binary)our correct guesses are two groupstrue positives (predicted to buy and did soand true negatives (predicted they wouldn' buy and they didn'tour incorrect guesses are divided into two groupsfalse positives (predicted they would buy but they didn'tand false negatives (predicted not to buy but they didthe matrix is useful to see where the model is having the most problems in this case we tend to be overconfident in our product and classify customers as future buyers too easily (false positivefrom the confusion matrixwe can deduce that for most images the predictions are quite accurate in good model you' expect the sum of the numbers on the main diagonal of the matrix (also known as the matrix traceto be very high compared to the sum of all matrix entriesindicating that the predictions were correct for the most part let' assume we want to show off our results in more easily understandable way or we want to inspect several of the images and the predictions our program has madewe can use the following code to display one next to the other then we can see where the program has gone wrong and needs little more training if we're satisfied with the resultsthe model building ends here and we arrive at step sixpresenting the results listing inspecting predictions vs actual numbers adds an extra subplot on plot grid this code could be simplified asplt subplot ( ,indexbut this looks visually more appealing stores number image matrix and its prediction (as numbertogether in array images_and_predictions list(zip(digits imagesfit predict( ))for index(imagepredictionin enumerate(images_and_predictions[: ])plt subplot( ,index plt axis('off'plt imshow(imagecmap=plt cm gray_rinterpolation='nearest'plt title('prediction%ipredictionplt show(shows shows the full plot that is now populated with subplots shows the predicted value as the title to the shown image loops through first images doesn' show an axis image in grayscale figure shows how all predictions seem to be correct except for the digit number which it labels as we should forgive this mistake as this does share visual similarities