# When the Answer Is Rare

When the class you're looking for is rare, accuracy rewards ignoring it, so you score a DummyClassifier that always guesses the most common class as the baseline to beat, read recall and balanced accuracy (the average of each class's recall) instead, and know that class_weight='balanced' moves the model toward the rare class while only more examples of it teach the model more.

![Cheat sheet: When the Answer Is Rare](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/681e1956dcf04af88e799e5deb19baa5.webp)

- Category: Machine Learning
- Level: Journeyman
- Tags: ai, Balanced Accuracy, Baseline (ai), Class Imbalance, DummyClassifier, python
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/ml-imbalanced-classes-cheat-sheet
