# Statistical Comparisons of Classifiers over Multiple Data Sets

Rank-based tests offer a safer way to compare classifiers across data sets

Janez Demšar · Journal of Machine Learning Research

- **Problem** Comparing several classifiers over several data sets has no settled method. Papers often use matrices of pairwise McNemar tests, and Bonferroni correction is rarely applied, which inflates false positives.
- **Method** Demšar proposes ranking the algorithms on each data set and testing the average ranks. Friedman's test does the first check, and Nemenyi or Bonferroni-Dunn tests find which pairs differ.
- **Results** On simulated selections of ten data sets, the Wilcoxon test rejected the null hypothesis more often than the paired t-test.

## Why multi-data-set comparisons stay ad hoc

Comparing two classifiers on one data set is well studied, but comparing several classifiers over several data sets is still unsettled. The authors checked the recent ICML proceedings from 1999 to 2003 to see what practice looks like. Many otherwise excellent papers end with a matrix of McNemar's tests over all pairs of classifiers, as if ANOVA and the Friedman test were yet to be invented.

Pairwise t-tests are about the only significance test in use, and averages over the data sets are seldom used. The Bonferroni correction shows up in only a few ICML papers a year, even though authors often warn against multiple hypothesis testing.

Single-data-set work has its own problems, but the multiple-data-set setting is different. Earlier work on comparing classifiers over several data sets is thin: Salzberg uses a binomial test with Bonferroni, and Hull and Brazdil and Soares use non-parametric or average-rank methods. Those authors either lack statistical grounding or do not test significance at all.

The paper asks which tests suit comparing two or more classifiers on multiple data sets. The authors assume only that the scores are reliable, which means enough experiments per data set. Ideally, all algorithms are evaluated on the same random samples, and the authors make no other assumption about the sampling scheme. Given the assumptions of each test, the paper examines the fit of each to this problem before running experiments.

## Key idea: rank the algorithms instead of assuming normality

The authors work with ranks because the raw accuracy scores may not meet the assumptions that ANOVA needs. ANOVA assumes that the samples are drawn from normal distributions. For classification accuracies across a set of problems, there is no guarantee of normality. Ranks sidestep both problems, because they only record the order of the algorithms on each data set.

ANOVA divides the total variability into a part due to the classifiers, a part due to the data sets and a residual error. If the between-classifiers variability is significantly larger than the error variability, the null-hypothesis can be rejected. These procedures behave like a t-test, but their critical values are higher. The higher critical values keep the chance of any false pairwise difference at most 5 %.

The Friedman statistic compares the average ranks R\_j of the algorithms against the equal ranks expected under the null-hypothesis. Iman and Davenport showed that the Friedman chi-square is undesirably conservative, so the authors use the better F statistic.

## How the Friedman test and its post-hoc steps run

The Friedman test ranks the algorithms separately for each data set, giving the best performing algorithm rank 1. The test then compares the average ranks R\_j = (1/N) times the sum over i of r\_ji across the N data sets. Under the null hypothesis, all algorithms are equivalent, so their ranks R\_j should be equal.

Iman and Davenport showed that the chi-square version of Friedman's statistic is undesirably conservative. They derived a better statistic F\_F, which follows an F-distribution with k − 1 and (k − 1)(N − 1) degrees of freedom. Friedman's experiment on 56 independent problems showed that his test and repeated-measures ANOVA mostly agree. When ANOVA finds significance at p \< 0.01, the Friedman test shows significance of at least p \< 0.05.

If the null hypothesis is rejected, the Nemenyi test compares all classifiers with each other, similar to Tukey's test for ANOVA. Two classifiers differ significantly when their average ranks differ by at least CD = q\_alpha times the square root of k(k + 1)/(6N). The q\_alpha values come from the Studentized range statistic divided by the square root of 2.

When all classifiers are compared with a control, the Bonferroni-Dunn test divides alpha by k − 1, which gives it more power than Nemenyi in that setting. Holm and Hochberg compare the ordered p values with alpha over k − i, while Hommel's procedure is harder to compute. The authors note that the enhanced methods differ little in practice, so Hommel's extra complexity buys little over Holm.

The worked example compares four C4.5 variants, with m fixed or fitted and cf fixed or fitted. C4.5+m and C4.5+m+cf ranked second with average ranks 2.000 and 1.964. C4.5 and C4.5+cf ranked third with average ranks 3.143 and 2.893. The Friedman statistic for this example is 9.28, computed against the mean rank 2.5 expected under the null hypothesis.

The Iman and Davenport statistic for this example is 3.69.

## Do the tests behave as the theory suggests

The authors draw samples of ten data sets from a compendium of forty UCI data sets and record the p values, repeating this 1000 times. The chance that a data set is picked rises with its accuracy difference, through a logistic function controlled by the bias k. At k = 0 the selection is uniform, and larger k favours one of the two learners more strongly.

Because the true hypothesis is unknown for real data, the authors don't measure Type 1 and Type 2 errors and measure rejection rates and replicability instead.

Power is approximated in two ways, by the share of experiments that reject at the 5 % level and by the average p value. Bouckaert's R(e) measures whether two experiments agree in accepting or rejecting the null hypothesis. The authors also define R(p) = 1 - 2 var(p) from the variance of the p values, so a variable selection shrinks it.

The Wilcoxon signed-ranks test gives much lower p values than the t-tests and rejects the null hypothesis more often in almost all cases. The t-test on relative differences is slightly but consistently weaker than the t-test on absolute differences. The sign test is much weaker than the other tests, as the theory predicts. The authors read the stronger rejections of the non-parametric tests as a hint of outliers or violated parametric assumptions.

On Friedman's 56 independent problems, his test and repeated-measures ANOVA mostly agreed. ANOVA alone found significance in 2 cases, while Friedman alone did so in 4 cases. Judged by R(p), the Wilcoxon test shows the smallest variation of p values. Judged by R(e), it is the least reliable near p = 0.05, because its rejections cluster close to the chosen α.

## Post-hoc results when several classifiers are compared

When all classifiers are compared with a control classifier, the Bonferroni-Dunn test can beat the Nemenyi test on power. The Nemenyi test adjusts the critical value for k(k-1)/2 comparisons, while a control comparison makes only k-1 comparisons. The Bonferroni-Dunn test divides α by the number of comparisons, which is k-1 in this case. Its CD uses the Nemenyi equation with the critical values for α/(k-1), listed in Table 5(b).

The authors advise against pairwise comparisons when the only question is whether a new method beats the existing ones.

The authors compare all seven algorithms but count rejections for one pair at a time, as in Figure 6. The pairs are C4.5-cf against naive Bayesian classifier and C4.5-cf against kNN, compared with the parametric Tukey test and the non-parametric Nemenyi test. The Nemenyi test rejects the null hypothesis more often than the Tukey test in these runs.

When the differences are large, all tests have comparable power. When the differences are smaller, the parametric test's rejection count lags behind.

Holm and Hochberg give practically equal results in these experiments. Holm's step-down and Hochberg's step-up procedures both compare each p\_i with α/(k-i). The CD diagram shows the order of the algorithms, the rank differences and the significance of the observed differences together. The authors argue that this visual form presents these results more clearly than textual or purely numerical output.

## What the experiments leave untested

The empirical study doesn't analyse Type 1 or Type 2 error rates at all. It depends on the kind of difference between the algorithms the researcher intends to measure. Measuring these error rates would need data sets and classifiers with prescribed error probabilities and distributions. That would require assumptions about real-world distributions, which are exactly what the paper tests.

The experiments use forty real-world data sets from the UCI repository, restricted to data sets with discrete classes. Artificial data sets like the Monk problems are avoided. Accuracies are measured in advance with ten-fold cross validation, and the selection is only a simulation. Choosing data sets by their known success would be cheating in a practical evaluation.

Replicability depends on how many data sets are used, because the variance of p shrinks as the bias k grows. The authors judge that forty data sets keep this variability practically unaffected for the k values they used. They didn't test smaller collections, so their effect on replicability stays unmeasured.

The authors note that replicability might be a problem, so experiments should use as many data sets as possible. The recommendation for the Wilcoxon and Friedman tests rests on these simulated selections of data sets.

## What the authors recommend

The authors recommend the Wilcoxon signed-ranks test for comparing two classifiers over multiple data sets. For comparing more classifiers, they recommend the Friedman test with its corresponding post-hoc tests. They present the results of these post-hoc tests with CD diagrams.

These tests are non-parametric, so they don't assume normal distributions or homogeneity of variance. They assume only limited commensurability between the measurements, which suits classifier results from different data sets. Because of that, the authors say the tests can be applied to error ratios, model sizes and computation times, not only to accuracy.

In their experiments, the Wilcoxon and Friedman tests were also stronger than the other tests studied, especially when comparing a pair of classifiers.

For post-hoc comparisons over all pairs, Holm's procedure is more powerful than the Bonferroni-Dunn test and makes no additional assumptions. When every classifier is compared only with a control classifier, the Bonferroni-Dunn test has much more power than the Nemenyi test. The Bonferroni-Dunn test is easier to describe and visualize, since it uses the same CD for all comparisons.

Hommel's method offers no great advantage over Holm's, so the simpler Holm procedure suffices.

The conclusions still depend on the number of data sets, and replicability can suffer when there are few of them. So the authors advise running the actual experiments on as many data sets as possible. They didn't analyze Type 1 or Type 2 error rates, because the correct result depends on the difference the researcher wants to detect. The authors still see significance tests as useful, provided they are performed correctly and their conclusions are reported carefully.

## Paper info

- **Authors**: Janez Demšar
- **Venue**: Journal of Machine Learning Research · Published
- **Added**: 2026-11-11
- **Original paper terms**: [Check in the original ↗](https://www.jmlr.org/papers/v7/demsar06a.html)
- **What we show**: Paper info and commentary

[Original paper ↗](https://www.jmlr.org/papers/v7/demsar06a.html) · [PDF ↗](https://jmlr.org/papers/volume7/demsar06a/demsar06a.pdf)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Janez Demšar (2006). Statistical Comparisons of Classifiers over Multiple Data Sets. Journal of Machine Learning Research. https://www.jmlr.org/papers/v7/demsar06a.html

**BibTeX**

```
@article{demar2006statistical,
  title = {{Statistical Comparisons of Classifiers over Multiple Data Sets}},
  author = {Janez Demšar},
  year = {2006},
  journal = {Journal of Machine Learning Research},
  url = {https://www.jmlr.org/papers/v7/demsar06a.html}
}
```

## Other paper commentary

- [Explainable Artificial Intelligence (XAI): Concepts, Taxonomies, Opportunities and Challenges toward Responsible AI](https://refivu.com/en/papers/3f686a20-03db-4642-80bb-f85fafc1d04f-explainable-artificial-intelligence-xai-concepts-taxonomies.md)
- [V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation](https://refivu.com/en/papers/a6e119c3-3c19-41b0-afee-c1d81e538a35-v-net-fully-convolutional-neural-networks-for-volumetric.md)
- [Stop Explaining Black Box Machine Learning Models for High Stakes Decisions and Use Interpretable Models Instead](https://refivu.com/en/papers/96d240ca-7c32-4f79-8167-c2beafc2a38f-stop-explaining-black-box-machine-learning-models-for.md)
- [Aggregated Residual Transformations for Deep Neural Networks](https://refivu.com/en/papers/e793fb66-bc1f-4ced-89ed-5f634b4590ea-aggregated-residual-transformations-for-deep-neural-networks.md)
- [Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network](https://refivu.com/en/papers/5a2dbd66-c794-464b-9d10-02f19eeb20e7-photo-realistic-single-image-super-resolution-using-a.md)
- [UMAP: Uniform Manifold Approximation and Projection for Dimension Reduction](https://refivu.com/en/papers/44ccc549-6643-4369-889c-f60f3d61cbf4-umap-uniform-manifold-approximation-and-projection-for.md)
- [Representation Learning: A Review and New Perspectives](https://refivu.com/en/papers/b38149f8-9f53-4406-8d25-bb93c21c4bc9-representation-learning-a-review-and-new-perspectives.md)
- [Intriguing properties of neural networks](https://refivu.com/en/papers/5d9b1ffd-1b1d-4795-87df-32680ad74683-intriguing-properties-of-neural-networks.md)

## Terms in this paper

- [C4.5](https://refivu.com/en/terms/eae906c7eb63-c4-5)
- [kNN](https://refivu.com/en/terms/c4c008424c75-knn)
- [Friedman test](https://refivu.com/en/terms/c7f4d0f6d5e2-friedman-test)
- [Nemenyi test](https://refivu.com/en/terms/9b34626cbabd-nemenyi-test)
- [Paired t-test](https://refivu.com/en/terms/0277aae8d881-paired-t-test)
- [UCI Machine Learning Repository](https://refivu.com/en/terms/73260ddae531-uci-machine-learning-repository)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/23a362a3-bc00-4b9e-b393-7a1b3290e6f8-statistical-comparisons-of-classifiers-over-multiple-data)
