In scikit-learn, accuracy_score reports the fraction of evaluated samples predicted correctly by default. That single figure can hide poor performance on a rare class, and in multilabel classification it uses a stricter all-labels-must-match rule. Pair it with metrics that reveal the errors your application cares about.
What does accuracy_score measure?
The documented signature is sklearn.metrics.accuracy_score(y_true, y_pred, *, normalize=True, sample_weight=None). For ordinary binary or multiclass classification, it compares each prediction with the corresponding true label and summarizes the share of correct predictions.
As an Amazon Associate I earn from qualifying purchases.
With the default normalize=True, the result is a fraction from 0 to 1. Set normalize=False to return the number of correct samples instead. The API example gives 0.5 for two correct predictions out of four, or 2.0 with normalization disabled. The optional sample_weight argument lets you weight samples; explain the reason for those weights when reporting a score. See the scikit-learn accuracy_score API documentation.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →For example, if 90 of 100 evaluated samples receive the correct class, normalized accuracy is 0.90. That tells you the overall share correct, not which classes were missed, whether mistakes have unequal costs, or whether predicted probabilities are well calibrated.
#1 Best Overall
- Use scikit-learn to track an example ML project end to end
- Explore several models, including support vector machines, decision trees, random forests, and ensemble methods
- Exploit unsupervised learning techniques such as dimensionality reduction, clustering, and anomaly detection
- Dive into neural net architectures, including convolutional nets, recurrent nets, generative adversarial networks, autoencoders, diffusion models, and transformers
- Use TensorFlow and Keras to build and train neural nets for computer vision, natural language processing, generative models, and deep reinforcement learning
How multilabel accuracy differs
In multilabel classification, scikit-learn reports subset accuracy: a sample counts as correct only if its entire predicted label set exactly matches its true label set. Getting nine labels right and one wrong still makes that whole sample incorrect. This is not the same as averaging correctness independently across labels. The API describes the exact-match rule in its multilabel accuracy documentation.
Because this measure treats any mismatch as a sample-level error, pair it with per-label precision, recall, or F1, or with Hamming loss, when partial matches and individual label errors matter. The scikit-learn model-evaluation guide describes these measures.
Rank #2
When can accuracy mislead?
Class imbalance
Accuracy weights samples, not classes. If one class dominates the evaluation set, a model can achieve a high score by predicting that class often while missing many examples of a less common class. For instance, when most cases belong to one class, a model that favors it may look strong in aggregate even if it rarely detects a minority class.
Scikit-learn describes balanced accuracy as a measure that avoids inflated performance estimates on imbalanced datasets. Accuracy is not inherently invalid: it remains useful when the class mix and the relative importance of mistakes make the overall share correct meaningful. Report the class distribution and add class-specific results when the aggregate could obscure important failures.
Rank #3
Different mistakes have different consequences
A false positive and a false negative may carry different costs. Accuracy counts both as incorrect but does not distinguish their consequences. In a setting where missing a positive case is especially costly, for example, a high accuracy score alone does not show whether the model finds enough positive cases.
Which metric should accompany accuracy?
| Evaluation question | Useful measure | How to interpret it |
|---|---|---|
| How well does the model find each class, giving classes equal weight? | Balanced accuracy | Average recall across classes; scikit-learn also documents it as equivalent to accuracy with class-balanced sample weights. Guide; API. |
| How many predicted positives are correct, and how many actual positives are found? | Precision and recall | Use class-specific values or state the averaging method. The measures expose different aspects of false-positive and false-negative behavior. Guide; API. |
| What is a combined summary of precision and recall? | F1 | State the averaging choice; a single F1 value compresses the precision–recall trade-off. Guide; API. |
| How well do prediction scores rank cases, rather than only classify them at one threshold? | ROC AUC | Evaluate scores rather than only final hard labels, and state the class setup and multiclass configuration. Guide; API. |
| Should a multiclass prediction count when the true class is among several leading choices? | Top-k accuracy | Define k; a sample counts correct if its true class is among the k highest-scored classes. Guide. |
| How many individual labels are wrong in a multilabel task? | Per-label precision, recall, or F1; Hamming loss | Use label-level measures alongside subset accuracy to reveal partial matches and label-specific performance. Guide. |
For precision, recall, and F1 across multiple classes, averaging changes the question being answered:
Rank #4
- Macro: gives each class equal weight.
- Weighted: accounts for each class’s support.
- Micro: pools contributions across sample-class pairs.
Choose the average that fits the decision, and name it when reporting the result. The scikit-learn guide explains why these averages are not interchangeable.
How to report an accuracy score responsibly
- Check the inputs: make sure
y_trueandy_predrefer to the same samples in the same order and use the intended label representation. The API accepts one-dimensional labels and multilabel indicator arrays or matrices. See the API documentation. - Choose the output form: use the default fraction or set
normalize=Falsefor a count. If you passsample_weight, explain what the weights represent. - Show the class mix: for an imbalanced dataset, include class distribution and a class-sensitive measure such as balanced accuracy or per-class recall.
- Name the multilabel measure correctly: call
accuracy_score‘s multilabel result subset accuracy, not per-label accuracy. - Describe the evaluation design: say what data the predictions came from and how evaluation was performed. Use held-out data or a suitable cross-validation procedure; a metric summarizes those predictions, but does not prove performance on future data. Scikit-learn discusses scoring in cross-validation and model-selection tools in its model-evaluation guide.
The signature and behaviors described here are documented in scikit-learn 1.9.1 materials. Documentation URLs labeled “stable” can advance; if your project relies on version-specific behavior, consult the documentation matching the scikit-learn version installed in that project.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




