Compute accuracy, precision, recall, and F1 for single-label predictions. Support averaging modes:
Input: y_true=[0,1,2,2], y_pred=[0,1,0,2]
Output (micro): accuracy≈0.75, precision≈0.75, recall≈0.75, f1≈0.75
Build a confusion matrix first, then compute TP, FP, FN for each class from the matrix.
For micro averaging, sum all TP, FP, FN across classes. For macro, compute per-class metrics then average.
Sign in to take notes on this problem
Accepts: array
Accepts: array
Accepts: string
Accepts: number
Compute accuracy, precision, recall, and F1 for single-label predictions. Support averaging modes:
Input: y_true=[0,1,2,2], y_pred=[0,1,0,2]
Output (micro): accuracy≈0.75, precision≈0.75, recall≈0.75, f1≈0.75
Build a confusion matrix first, then compute TP, FP, FN for each class from the matrix.
For micro averaging, sum all TP, FP, FN across classes. For macro, compute per-class metrics then average.
Sign in to take notes on this problem
Accepts: array
Accepts: array
Accepts: string
Accepts: number