I am trying to perform 5 fold cross validation in python using Keras ANN Classifier and I need a single mean classification report and confusion matrix for all the folds.
I could calculate the confusion matrix and the classification report for each fold and display them following the code snippet provided here.
Question:
How can I calculate the average confusion matrix and average report for all folds?
As far as confusion matrix is concerned, it's used to sum up the confusion matrices for each fold since they contain absolute values and not percentages. However, if you want to have an averaged confusion matrix you should create a confusion_mat_avg
variable of the same shape and just take the mean of each cell for all folds.
About the average report, the solution is similar. The following answer will probably give you a better idea.