1. Home
  2. Data Science
  3. Scikit-learn
  4. What does accuracy_score(y_true, y_pred) compute?

Added 30 Nov -0001

What does accuracy_score(y_true, y_pred) compute?

  1. The average probability that the model assigned to the correct class
  2. The area under the receiver operating curve
  3. The mean squared difference between labels
  4. The fraction of predictions that match the true labels Correct answer

Correct answer

D. The fraction of predictions that match the true labels

16 views

MCQSEXAM

Explanation

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.

Reference

Asked in: NTS, PPSC IT, Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Scikit-learn MCQs

Practise all Scikit-learn MCQs

Similar MCQs