from the preceding outputit is clear that we have observations in our train dataset and observations in our test dataset we will be leveraging nifty module we have created for model evaluation it is named model_evaluation_utils and you can find it along with the code files and notebooks for this we recommend you to check out the codewhich leverages the scikit-learn metrics module to compute most of the evaluation metrics and plots confusion matrix confusion matrix is one of the most popular ways to evaluate classification model although the matrix by itself is not metricthe matrix representation can be used to define variety of metricsall of which become important in some specific case or scenario confusion matrix can be created for binary classification as well as multi-class classification model confusion matrix is created by comparing the predicted class label of data point with its actual class label this comparison is repeated for the whole dataset and the results of this comparison are compiled in matrix or tabular format this resultant matrix is our confusion matrix before we go any furtherlet' build logistic regression model on our breast cancer dataset and look at the confusion matrix for the model predictions on the test dataset from sklearn import linear_model train and build the model logistic linear_model logisticregression(logistic fit(x_train,y_trainpredict on test data and view confusion matrix import model_evaluation_utils as meu y_pred logistic predict(x_testmeu display_confusion_matrix(true_labels=y_testpredicted_labels=y_predclasses=[ ]predicted actual the preceding output depicts the confusion matrix with necessary annotations we can see that out of observations with label (malignant)our model has correctly predicted observations similarly out of observations with label (benign)our model has correctly predicted observations more detailed analysis is coming right upunderstanding the confusion matrix while the name itself sounds pretty overwhelmingunderstanding the confusion matrix is not that confusing once you have the basics rightto reiterate what you learned in the previous sectionthe confusion matrix is tabular structure to keep track of correct classifications as well as misclassifications this is useful to evaluate the performance of classification model for which we know the true data labels and can compare with the predicted data labels each column in the confusion matrix represents classified instance counts based on predictions from the model and each row of the matrix represents instance counts based on the actual\true class labels this structure can also be reversedi predictions depicted by rows and true labels by columns in typical binary classification problemwe usually have class label which defined as the positive class which is basically the class of our interest for instance in our breast cancer datasetlet' say we