All problems
Confusion Pair Mining
Problem
Find the most frequent ordered confusion pair. Return [gold, predicted, count] with the highest count, breaking ties by gold and then predicted alphabetically.
Return an empty list when there are no errors.
Hint
Iterate the sorted pair keys and keep the first strict maximum.
Test cases
case 1
in: [["a","a","b","b"],["b","c","c","a"]]
expected: ["a","b",1]
case 2
in: [["a","a","a"],["b","b","c"]]
expected: ["a","b",2]
case 3
in: [["a","b"],["a","b"]]
expected: []
case 4
in: [[],[]]
expected: []
Starter codePython
def confusion_pair_mining(gold_labels, predicted_labels):
# Your code here
pass4 test cases · run your code against them in the editor