step fit data machine learning gnb gaussiannb(fit gnb fit(x_train,y_trainpredicted fit predict(x_testconfusion_matrix(y_testpredictedstep create confusion matrix step select naive bayes classifieruse gaussian distribution to estimate probability step predict data for unseen data the end result of this code is called confusion matrixsuch as the one shown in figure returned as two-dimensional arrayit shows how often the number predicted was the correct number on the main diagonal and also in the matrix entry ( , )where was predicted but the image showed looking at figure we can see that the model predicted the number correctly times (at coordinates , )but also that the model predicted the number times when it was actually the number in the image (at , figure confusion matrix produced by predicting what number is depicted by blurry image confusion matrices confusion matrix is matrix showing how wrongly (or correctlya model predictedhow much it got "confused in its simplest form it will be table for models that try to classify observations as being or let' say we have classification model that predicts whether somebody will buy our newest productdeep-fried cherry pudding we can either predict"yesthis person will buyor "nothis customer won' buy once we make our prediction for people we can compare this to their actual behaviorshowing us how many times we got it right an example is shown in table table confusion matrix example confusion matrix predicted "person will buypredicted "person will not buyperson bought the deep-fried cherry pudding (true positive (false negativeperson didn' buy the deepfried cherry pudding (false positive (true negative