Skip to content
Saed Sayad

ZeroR

ZeroR is the simplest classifier: ignore every predictor and always predict the majority class. Useless alone, essential as a baseline benchmark.

4 min read · Updated August 8, 2026

ZeroR is the simplest classification method there is: it relies on the target alone and ignores all predictors. The ZeroR classifier simply predicts the majority class, every time, for every input.

ZeroR has no predictive power, but it is far from useless. It defines the baseline performance that every other classification method must beat — a model that cannot outperform “always guess the most frequent class” has learned nothing.

The ZeroR algorithm

Construct a frequency table for the target and select its most frequent value. Formally, if class cc occurs ncn_c times in a training set of nn rows, ZeroR predicts

y^=argmaxc  ncn\hat{y} = \arg\max_{c} \; \frac{n_c}{n}

for every row, and its training accuracy is exactly the majority proportion maxcnc/n\max_c n_c / n.

Worked example: Play Golf

The 14-row Play Golf dataset records weather conditions and whether a round of golf was played:

OutlookTempHumidityWindyPlay Golf
RainyHotHighFalseNo
RainyHotHighTrueNo
OvercastHotHighFalseYes
SunnyMildHighFalseYes
SunnyCoolNormalFalseYes
SunnyCoolNormalTrueNo
OvercastCoolNormalTrueYes
RainyMildHighFalseNo
RainyCoolNormalFalseYes
SunnyMildNormalFalseYes
RainyMildNormalTrueYes
OvercastMildHighTrueYes
OvercastHotNormalFalseYes
SunnyMildHighTrueNo

The frequency table for the target is:

Play GolfCount
Yes9
No5

Yes is the majority class, so the ZeroR model is simply “Play Golf = Yes” — regardless of Outlook, Temp, Humidity, or Windy. Its accuracy is the majority proportion:

Accuracy=9140.64\text{Accuracy} = \frac{9}{14} \approx 0.64

Predictor contribution

There is nothing to say about predictor contribution, because ZeroR does not use any of them. That is precisely what makes it a clean benchmark: any contribution a fancier model extracts from the predictors shows up as accuracy above 0.64.

Model evaluation

The confusion matrix shows that ZeroR only ever predicts the majority class:

Actual YesActual No
Predicted Yes95PPV = 9/14 = 0.64
Predicted No00NPV = 0.00
Sensitivity = 1.00Specificity = 0.00Accuracy = 0.64

Sensitivity is a perfect 1.00 (every actual Yes is caught) while specificity is 0.00 (no actual No is ever identified) — the signature of a classifier that is not really classifying. See Model Evaluation — Classification for what these metrics mean.

In practice

scikit-learn ships ZeroR under the honest name sklearn.dummy.DummyClassifier with strategy="most_frequent". Fit it alongside every real model: on imbalanced problems it is the difference between a meaningful score and an embarrassing one — a fraud detector that always predicts “legitimate” can score 99% accuracy while being worse than useless. ZeroR also anchors OneR: the gap between the two is the value of a single predictor.

Common pitfalls

  • Reporting accuracy without the baseline. On skewed data, a high accuracy can sit at or even below the ZeroR rate.
  • Mistaking high sensitivity for skill. ZeroR gets perfect sensitivity by never predicting the minority class; read sensitivity and specificity together.
  • Using ZeroR as a real model. It cannot rank predictors, produce useful probabilities, or adapt to any input.
  • Forgetting that the baseline shifts with the data. Recompute it whenever the class distribution changes.

Summary

ZeroR predicts the majority class and ignores all predictors. On the Play Golf data it always predicts Yes and scores 9/14 ≈ 0.64. It has no predictive power, but as a baseline it is the first number you should compute in any classification project.