Intent routing per-class correct
Your task
A chatbot routes each user message to one of several intents, numbered 0 to num_classes - 1. The eval dashboard shows, per intent, how many messages the model routed correctly. Given equal-length lists y_true and y_pred of intent ids and the integer num_classes, return a list of length num_classes where position c holds the count of messages with y_true[i] == c and y_pred[i] == c. All ids are valid (between 0 and num_classes - 1). Example: y_true = [0, 1, 2, 1], y_pred = [0, 2, 2, 1], num_classes = 3 gives [1, 1, 1].
Examples
correct_per_class(y_true: list[int], y_pred: list[int], num_classes: int) -> list[int]Example 1
Input
correct_per_class([0, 1, 2, 1], [0, 2, 2, 1], 3)Output
[1, 1, 1]