NumPy allowed · plain Python earns 10 bonus points
Computed matrix × vector transformation
Construct a multi-class confusion matrix from ground-truth and predicted labels using vectorized NumPy operations.
Implement vectorized_confusion_matrix(y_true, y_pred, num_classes). For labels in $0 \dots C-1$, generate the $C \times C$ contingency table where row $i$ is the actual class and column $j$ is the predicted class. Return a 2D list of integers.
vectorized_confusion_matrix(y_true: list[int], y_pred: list[int], num_classes: int) -> list[list[int]]