A spam filter has been tested on a handful of emails. y_true holds what each email really was and y_pred holds what the filter said. In both lists, 1 means spam (the positive class) and 0 means not spam.
Task: write four_boxes(y_true, y_pred) and return a dict with four whole numbers:
| key | counts the emails that were… |
|---|---|
"tn" | really not spam, called not spam |
"fp" | really not spam, called spam |
"fn" | really spam, called not spam |
"tp" | really spam, called spam |
Both 0 and 1 appear in y_true. The two lists always have the same length.