What does accuracy_score(y_true, y_pred) compute?
Correct answer
D. The fraction of predictions that match the true labels
16 views
D. The fraction of predictions that match the true labels
16 views
accuracy_score divides the number of correct predictions by the total number of samples, giving a single proportion between 0 and 1. It is intuitive but misleading on imbalanced data, where predicting the majority class alone can score above 90 percent. Precision, recall and the F1 score are preferred when the classes are skewed or the cost of errors is asymmetric.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is D? Ask here and get an explanation.