Accuracy Calculator
Compute classification accuracy from y_true and y_pred.
About this tool
Paste the true labels and the predicted labels and get classification accuracy: the share of predictions that match. The result also lists the labels and the confusion matrix rows so you can see where the errors are.
How to use
How it works
Accuracy = number of correct predictions ÷ total predictions. It is easy to read but misleading for imbalanced classes: predicting the majority class every time can score 95% when the minority class is 5% of the data. Check precision, recall and F1 as well.
accuracy = (TP + TN) / total (for any number of classes: correct ÷ n)
Worked example
Three right out of five
- Input
- y_true: cat, cat, dog, dog, dog y_pred: cat, dog, dog, dog, cat
- Output
- Accuracy 0.6; support 5
- Walkthrough
- Positions 1, 3 and 4 match, so 3 / 5 = 0.6.
Limitations
- Accuracy hides class imbalance; use F1 for skewed data.
- Lists must have equal length.
- Labels are compared as exact text.
Questions
How do I calculate accuracy?
Is 90% accuracy good?
What is the difference between accuracy and F1?
Does it give a percentage?
Features
- Accuracy from labels
- Support and matrix rows
- Runs in your browser
Related resources
Guides and videos from around the web—opens on YouTube or the publisher’s site.
Vectors | Essence of linear algebra
3Blue1Brown
Embeddings and vectors start with linear algebra intuition.
Watch on YouTubeBig-O Notation in 100 Seconds
Fireship
Complexity intuition when estimating training/inference cost.
Watch on YouTube
- DeepLearning.AI
DeepLearning.AI
Courses and explainers for modern AI tooling.
- OpenAI Research
OpenAI
Research notes for people exploring AI tooling trends.