The confusion matrix provides more insight into not only the performance of a predictive model, but also which classes are being predicted correctly, which incorrectly, and what type of errors are being made. The precision and recall metrics are defined in terms of the cells in the confusion matrix, specifically…