A confusion matrix is four set intersections. With the predicted positives and the actual positives:
Return a dict of the four counts under keys "tp", "fp", "fn", "tn".
solve({1,2,3}, {2,3,4}, {1,2,3,4,5})
-> {"tp": 2, "fp": 1, "fn": 1, "tn": 1}
Sign in to write and run your own code.
solve(...)