A wildlife charity runs a classifier over its camera-trap photos. Its test results come as a confusion matrix: matrix[i][j] counts the photos whose actual animal is classes[i] and whose predicted animal is classes[j]. Rows are actual classes, columns are predicted classes, and the diagonal holds the correct predictions.
Before spending money on more photos, the team wants three facts from the matrix.
classes. If pairs tie, take the one whose first class comes earliest in classes, and then the one whose second class does.classes.classes. Round the rate to 4 decimal places.Task: write error_report(classes, matrix) and return the tuple (pair, most_errors_class, highest_rate_class, highest_rate).
There are always at least two classes, and at least one class has actual photos.