accuracy
Accuracy, as a model evaluation metric, is simply the fraction of predictions a model got right — correct predictions divided by total predictions. It's the most intuitive metric in machine learning and also one of the easiest to misuse, because a high accuracy number can hide a model that's completely useless for the actual problem it was built to solve, specifically whenever the classes in the data aren't roughly balanced. At a high level, where accuracy fits among the broader family of classification metrics looks like this:
Accuracy becomes actively misleading the moment a dataset's classes are imbalanced, and the failure mode is specific and predictable. A wafer-defect classifier trained on a line where 99% of dies are good and 1% are defective can score 99% accuracy by simply predicting "good" for every single die, never once correctly catching an actual defect — the metric rewards matching the majority class, not detecting the thing that actually matters. This is exactly the scenario precision (of everything flagged as defective, how many actually were) and recall (of everything that was actually defective, how many did the model catch) exist to expose, since a model that never flags anything scores perfectly on accuracy while scoring zero on recall.
The fix isn't a more complicated model — it's reporting a metric that actually reflects what matters for the task, and often that means reporting several at once. F1 score combines precision and recall into one number (their harmonic mean), giving a single metric that penalizes a model for being bad at either one, which is why it's the standard default whenever a dataset is imbalanced and both false positives and false negatives carry real cost. A confusion matrix goes further still, laying out every combination of predicted versus actual class so an engineer can see exactly where a model's errors concentrate — a model that's weak specifically on one rare but critical failure mode looks identical to a strong model when you only look at aggregate accuracy, and completely different once you look at the confusion matrix broken out by class.
Balanced accuracy and class-weighted loss functions exist specifically to prevent the imbalance problem from ever reaching the evaluation stage in the first place. Balanced accuracy averages the recall achieved on each class individually rather than pooling all predictions together, which stops a model from being able to game the metric just by favoring the majority class; weighting the training loss itself to penalize mistakes on the minority class more heavily pushes the model to actually learn to detect the rare case during training, rather than relying purely on a smarter evaluation metric to catch a model that never learned to care about it.
Read accuracy as a metric that only tells the truth when the classes are roughly balanced and every type of mistake costs about the same: the moment either assumption breaks — a rare defect, a rare disease, a rare fraud case — accuracy alone stops measuring what actually matters, and the real engineering discipline is choosing precision, recall, F1, or a confusion matrix specifically because they can't be gamed the way a single aggregate number can.