of correctly classified examples and againwhen classes are imbalancedaccuracy is not great evaluation measure imagine three-class classification problem with of points belonging to class belonging to class band belonging to class what does being accurate mean on this datasetin generalmulticlass classification results are harder to understand than binary classification results apart from accuracycommon tools are the confusion matrix and the classification report we saw in the binary case in the previous section let' apply these two detailed evaluation methods on the task of classifying the different handwritten digits in the digits datasetin[ ]from sklearn metrics import accuracy_score x_trainx_testy_trainy_test train_test_splitdigits datadigits targetrandom_state= lr logisticregression(fit(x_trainy_trainpred lr predict(x_testprint("accuracy{ }format(accuracy_score(y_testpred))print("confusion matrix:\ {}format(confusion_matrix(y_testpred))out[ ]accuracy confusion matrix[[ ]the model has an accuracy of %which already tells us that we are doing pretty well the confusion matrix provides us with some more detail as for the binary caseeach row corresponds to true labeland each column corresponds to predicted label you can find visually more appealing plot in figure - in[ ]scores_image mglearn tools heatmapconfusion_matrix(y_testpred)xlabel='predicted label'ylabel='true label'xticklabels=digits target_namesyticklabels=digits target_namescmap=plt cm gray_rfmt="% "plt title("confusion matrix"plt gca(invert_yaxis(evaluation metrics and scoring