Journal of Machine Learning Research 7 (2006) 1–30

Submitted 8/04; Revised 4/05; Published 1/06

Statistical Comparisons of Classifiers
over Multiple Data Sets
Janez Demšar

JANEZ . DEMSAR @ FRI . UNI - LJ . SI

Faculty of Computer and Information ScienceTržaška 25
Ljubljana, Slovenia

Editor: Dale Schuurmans

Abstract
While methods for comparing two learning algorithms on a single data set have been scrutinized forquite some time already, the issue of statistical tests for comparisons of more algorithms on multiple
data sets, which is even more essential to typical machine learning studies, has been all but ignored.
This article reviews the current practice and then theoretically and empirically examines several
suitable tests. Based on that, we recommend a set of simple, yet safe and robust non-parametrictests for statistical comparisons of classifiers: the Wilcoxon signed ranks test for comparison of
two classifiers and the Friedman test with the corresponding post-hoc tests for comparison of moreclassifiers over multiple data sets. Results of the latter can also be neatly presented with the newly
introduced CD (critical difference) diagrams.
Keywords: comparative studies, statistical methods, Wilcoxon signed ranks test, Friedman test,
multiple comparisons tests

1. Introduction
Over the last years, the machine learning community has become increasingly aware of the need forstatistical validation of the published results. This can be attributed to the maturity of the area, theincreasing number of real-world applications and the availability of open machine learning frameworks that make it easy to develop new algorithms or modify the existing, and compare them among
themselves.
In a typical machine learning paper, a new machine learning algorithm, a part of it or some new
pre- or postprocessing step has been proposed, and the implicit hypothesis is made that such anenhancement yields an improved performance over the existing algorithm(s). Alternatively, various
solutions to a problem are proposed and the goal is to tell the successful from the failed. A numberof test data sets is selected for testing, the algorithms are run and the quality of the resulting models
is evaluated using an appropriate measure, most commonly classification accuracy. The remaining
step, and the topic of this paper, is to statistically verify the hypothesis of improved performance.
The following section explores the related theoretical work and existing practice. Various researchers have addressed the problem of comparing two classifiers on a single data set and proposedseveral solutions. Their message has been taken by the community, and the overly confident paired
t-tests over cross validation folds are giving place to the McNemar test and 5×2 cross validation.
On the other side, comparing multiple classifiers over multiple data sets—a situation which is evenmore common, especially when general performance and not the performance on certain specificc 2006 Janez Demšar.

D EM ŠAR

problem is tested—is still theoretically unexplored and left to various ad hoc procedures that either
lack statistical ground or use statistical methods in inappropriate ways. To see what is used in theactual practice, we have studied the recent (1999-2003) proceedings of the International Conference
on Machine Learning. We observed that many otherwise excellent and innovative machine learning
papers end by drawing conclusions from a matrix of, for instance, McNemar’s tests comparing allpairs of classifiers, as if the tests for multiple comparisons, such as ANOVA and Friedman test are
yet to be invented.
The core of the paper is the study of the statistical tests that could be (or already are) used forcomparing two or more classifiers on multiple data sets. Formally, assume that we have tested kjlearning algorithms on N data sets. Let ci be the performance score of the j-th algorithm on theji-th data set. The task is to decide whether, based on the values ci , the algorithms are statisticallysignificantly different and, in the case of more than two algorithms, which are the particular algorithms that differ in performance. We will not record the variance of these scores, σc j , but will onlyiassume that the measured results are “reliable”; to that end, we require that enough experiments
were done on each data set and, preferably, that all the algorithms were evaluated using the samerandom samples. We make no other assumptions about the sampling scheme.
In Section 3 we shall observe the theoretical assumptions behind each test in the light of ourproblem. Although some of the tests are quite common in machine learning literature, many researchers seem ignorant about what the tests actually measure and which circumstances they aresuitable for. We will also show how to present the results of multiple comparisons with neat spacefriendly graphs. In Section 4 we shall provide some empirical insights into the properties of thetests.

2. Previous Work
Statistical evaluation of experimental results has been considered an essential part of validationof new machine learning methods for quite some time. The tests used have however long beenrather naive and unverified. While the procedures for comparison of a pair of classifiers on a single
problem have been proposed almost a decade ago, comparative studies with more classifiers and/or
more data sets still employ partial and unsatisfactory solutions.
2.1 Related Theoretical WorkOne of the most cited papers from this area is the one by Dietterich (1998). After describing thetaxonomy of statistical questions in machine learning, he focuses on the question of deciding whichof the two algorithms under study will produce more accurate classifiers when tested on a given data
set. He examines five statistical tests and concludes the analysis by recommending the newly crafted
5×2cv t-test that overcomes the problem of underestimated variance and the consequently elevatedType I error of the more traditional paired t-test over folds of the usual k-fold cross validation.
For the cases where running the algorithm for multiple times is not appropriate, Dietterich finds
McNemar’s test on misclassification matrix as powerful as the 5×2cv t-test. He warns against ttests after repetitive random sampling and also discourages using t-tests after cross-validation. The
5×2cv t-test has been improved by Alpaydın (1999) who constructed a more robust 5×2cv F testwith a lower type I error and higher power.
2

S TATISTICAL C OMPARISONS OF C LASSIFIERS OVER M ULTIPLE DATA S ETSBouckaert (2003) argues that theoretical degrees of freedom are incorrect due to dependencies
between the experiments and that empirically found values should be used instead, while Nadeau
and Bengio (2000) propose the corrected resampled t-test that adjusts the variance based on theoverlaps between subsets of examples. Bouckaert and Frank (Bouckaert and Frank, 2004; Bouckaert, 2004) also investigated the replicability of machine learning experiments, found the 5×2cv
t-test dissatisfactory and opted for the corrected resampled t-test. For a more general work on the
problem of estimating the variance of k-fold cross validation, see the work of Bengio and Grandvalet(2004).
None of the above studies deal with evaluating the performance of multiple classifiers and neither studies the applicability of the statistics when classifiers are tested over multiple data sets. For
the former case, Salzberg (1997) mentions ANOVA as one of the possible solutions, but afterwards
describes the binomial test with the Bonferroni correction for multiple comparisons. As Salzberg
himself notes, binomial testing lacks the power of the better non-parametric tests and the Bonferroni correction is overly radical. Vázquez et al. (2001) and Pizarro et al. (2002), for instance, use
ANOVA and Friedman’s test for comparison of multiple models (in particular, neural networks) ona single data set.
Finally, for comparison of classifiers over multiple data sets, Hull (1994) was, to the best of ourknowledge, the first who used non-parametric tests for comparing classifiers in information retrieval
and assessment of relevance of documents (see also Schütze et al., 1995). Brazdil and Soares (2000)
used average ranks to compare classification algorithms. Pursuing a different goal of choosing the
optimal algorithm, they do not statistically test the significance of differences between them.
2.2 Testing in Practice: Analysis of ICML Papers
We analyzed the papers from the proceedings of five recent International Conferences on Machine
Learning (1999-2003). We have focused on the papers that compare at least two classifiers bymeasuring their classification accuracy, mean squared error, AUC (Beck and Schultz, 1986), precision/recall or some other model performance score.
The sampling methods and measures used for evaluating the performance of classifiers are notdirectly relevant for this study. It is astounding though that classification accuracy is usually still
the only measure used, despite the voices from the medical (Beck and Schultz, 1986; Bellazzi andZupan, 1998) and the machine learning community (Provost et al., 1998; Langley, 2000) urging that
other measures, such as AUC, should be used as well. The only real competition to classification
accuracy are the measures that are used in the area of document retrieval. This is also the only
field where the abundance of data permits the use of separate testing data sets instead of using crossvalidation or random sampling.
Of greater interest to our paper are the methods for analysis of differences between the algorithms. The studied papers published the results of two or more classifiers over multiple data sets,
usually in a tabular form. We did not record how many of them include (informal) statements about
the overall performance of the classifiers. However, from one quarter and up to a half of the papers
include some statistical procedure either for determining the optimal method or for comparing theperformances among themselves.
The most straightforward way to compare classifiers is to compute the average over all data sets;such averaging appears naive and is seldom used. Pairwise t-tests are about the only method used forassessing statistical significance of differences. They fall into three categories: only two methods
3

D EM ŠAR

1999
54
19

2000
152
45

2001
80
25

2002
87
31

2003
118
54

Sampling method [%]cross validation, leave-one-out
random resampling
separate subset

22
11
5

49
29
11

44
44
0

42
32
13

56
54
9

Score function [%]classification accuracy
classification accuracy - exclusively
recall, precision. . .
ROC, AUC

74
68
21
0

67
60
18
4

84
80
16
4

84
58
25
13

70
67
19
9

deviations, confidence intervals

32

42

48

42

19

Overall comparison of classifiers [%]averages over the data sets

53
0

44
4

44
6

26
0

45
10

t-test to compare two algorithms
pairwise t-test one vs. others
pairwise t-test each vs. each

16
5
16

11
11
13

4
16
4

6
3
6

7
7
4

counts of wins/ties/losses
counts of significant wins/ties/losses

5
16

4
4

0
8

6
16

9
6

Total number of papers
Relevant papers for our study

Table 1: An overview of the papers accepted to International Conference on Machine Learningin years 1999—2003. The reported percentages (the third line and below) apply to thenumber of papers relevant for our study.

are compared, one method (a new method or the base method) is compared to the others, or all
methods are compared to each other. Despite the repetitive warnings against multiple hypotheses
testing, the Bonferroni correction is used only in a few ICML papers annually. A common nonparametric approach is to count the number of times an algorithm performs better, worse or equallyto the others; counting is sometimes pairwise, resulting in a matrix of wins/ties/losses count, and thealternative is to count the number of data sets on which the algorithm outperformed all the others.
Some authors prefer to count only the differences that were statistically significant; for verifying
this, they use various techniques for comparison of two algorithms that were reviewed above.
This figures need to be taken with some caution. Some papers do not explicitly describe thesampling and testing methods used. Besides, it can often be hard to decide whether a specificsampling procedure, test or measure of quality is equivalent to the general one or not.

3. Statistics and Tests for Comparison of Classifiers
The overview shows that there is no established procedure for comparing classifiers over multiple
data sets. Various researchers adopt different statistical and common-sense techniques to decide
whether the differences between the algorithms are real or random. In this section we shall examine
4

S TATISTICAL C OMPARISONS OF C LASSIFIERS OVER M ULTIPLE DATA S ETS

several known and less known statistical tests, and study their suitability for our purpose from thepoint of what they actually measure and of their safety regarding the assumptions they make about
the data.
As a starting point, two or more learning algorithms have been run on a suitable set of data
sets and were evaluated using classification accuracy, AUC or some other measure (see Tables 2
and 6 for an example). We do not record the variance of these results over multiple samples, andtherefore assume nothing about the sampling scheme. The only requirement is that the compiled
results provide reliable estimates of the algorithms’ performance on each data set. In the usualexperimental setups, these numbers come from cross-validation or from repeated stratified random
splits onto training and testing data sets.
There is a fundamental difference between the tests used to assess the difference between twoclassifiers on a single data set and the differences over multiple data sets. When testing on a single
data set, we usually compute the mean performance and its variance over repetitive training andtesting on random samples of examples. Since these samples are usually related, a lot of care isneeded in designing the statistical procedures and tests that avoid problems with biased estimationsof variance.
In our task, multiple resampling from each data set is used only to assess the performance
score and not its variance. The sources of the variance are the differences in performance over(independent) data sets and not on (usually dependent) samples, so the elevated Type 1 error is
not an issue. Since multiple resampling does not bias the score estimation, various types of crossvalidation or leave-one-out procedures can be used without any risk.
Furthermore, the problem of correct statistical tests for comparing classifiers on a single data
set is not related to the comparison on multiple data sets in the sense that we would first have tosolve the former problem in order to tackle the latter. Since running the algorithms on multiple data
sets naturally gives a sample of independent measurements, such comparisons are even simpler thancomparisons on a single data set.
We should also stress that the “sample size” in the following section will refer to the number ofdata sets used, not to the number of training/testing samples drawn from each individual set or to
the number of instances in each set. The sample size can therefore be as small as five and is usuallywell below 30.
3.1 Comparisons of Two Classifiers
In the discussion of the tests for comparisons of two classifiers over multiple data sets we will maketwo points. We shall warn against the widely used t-test as usually conceptually inappropriate andstatistically unsafe. Since we will finally recommend the Wilcoxon (1945) signed-ranks test, it will
be presented with more details. Another, even more rarely used test is the sign test which is weaker
than the Wilcoxon test but also has its distinct merits. The other message will be that the described
statistics measure differences between the classifiers from different aspects, so the selection of thetest should be based not only on statistical appropriateness but also on what we intend to measure.
3.1.1 AVERAGING OVER DATA S ETS
Some authors of machine learning papers compute the average classification accuracies of classifiers
across the tested data sets. In words of Webb (2000), “it is debatable whether error rates in different
domains are commensurable, and hence whether averaging error rates across domains is very mean5

D EM ŠAR

ingful”. If the results on different data sets are not comparable, their averages are meaningless. A
different case are studies in which the algorithms are compared on a set of related problems, such as
medical databases for a certain disease from different institutions or various text mining problems
with similar properties.
Averages are also susceptible to outliers. They allow classifier’s excellent performance on one
data set to compensate for the overall bad performance, or the opposite, a total failure on one domain
can prevail over the fair results on most others. There may be situations in which such behaviour
is desired, while in general we probably prefer classifiers that behave well on as many problems as
possible, which makes averaging over data sets inappropriate.
Given that not many papers report such averages, we can assume that the community generally finds them meaningless. Consequently, averages are also not used (nor useful) for statisticalinference with the z- or t-test.
3.1.2 PAIRED T-T EST
A common way to test whether the difference between two classifiers’ results over various data sets
is non-random is to compute a paired t-test, which checks whether the average difference in theirperformance over the data sets is significantly different from zero.
Let c1i and c2i be performance scores of two classifiers on the i-th out of N data sets and let dibe the difference c2i − c1i . The t statistics is computed as d/σd and is distributed according to theStudent distribution with N − 1 degrees of freedom.
In our context, the t-test suffers from three weaknesses. The first is commensurability: the t-test
only makes sense when the differences over the data sets are commensurate. In this view, using
the paired t-test for comparing a pair of classifiers makes as little sense as computing the averages
over data sets. The average difference d equals the difference between the averaged scores of thetwo classifiers, d = c2 − c1 . The only distinction between this form of the t-test and comparing
the two averages (as those discussed above) directly using the t-test for unrelated samples is in the
denominator: the paired t-test decreases the standard error σd by the variance between the data sets(or, put another way, by the covariance between the classifiers).
Webb (2000) approaches the problem of commensurability by computing the geometric means
1
2of relative ratios, (∏i c1i /c2i )1/N . Since this equals to e1/N ∑i (ln ci −ln ci ) , this statistic is essentiallythe same as the ordinary averages, except that it compares logarithms of scores. The utility of thistransformation is thus rather questionable. Quinlan (1996) computes arithmetic means of relative
ratios; due to skewed distributions, these cannot be used in the t-test without further manipulation.
A simpler way of compensating for different complexity of the problems is to divide the differencec1i −c2iby the average score, di = (c1 +c
2 )/2 .
ii

The second problem with the t-test is that unless the sample size is large enough (∼ 30 datasets), the paired t-test requires that the differences between the two random variables compared are
distributed normally. The nature of our problems does not give any provisions for normality and thenumber of data sets is usually much less than 30. Ironically, the Kolmogorov-Smirnov and similar
tests for testing the normality of distributions have little power on small samples, that is, they are
unlikely to detect abnormalities and warn against using the t-test. Therefore, for using the t-test weneed normal distributions because we have small samples, but the small samples also prohibit us
from checking the distribution shape.
6

S TATISTICAL C OMPARISONS OF C LASSIFIERS OVER M ULTIPLE DATA S ETS

adult (sample)
breast cancer
breast cancer wisconsin
cmc
ionosphereiris
liver disorders
lung cancer
lymphography
mushroom
primary tumor
rheum
voting
wine

C4.5
0.763
0.599
0.954
0.628
0.882
0.936
0.661
0.583
0.775
1.000
0.940
0.619
0.972
0.957

C4.5+m
0.768
0.591
0.971
0.661
0.888
0.931
0.668
0.583
0.838
1.000
0.962
0.666
0.981
0.978

difference+0.005−0.008+0.017+0.033+0.006−0.005+0.0070.000+0.0630.000+0.022+0.047+0.009+0.021

rank
3.5
7
9
12
5
3.5
6
1.5
14
1.5
11
13
8
10

Table 2: Comparison of AUC for C4.5 with m = 0 and C4.5 with m tuned for the optimal AUC. The
columns on the right-hand illustrate the computation and would normally not be publishedin an actual paper.

The third problem is that the t-test is, just as averaging over data sets, affected by outliers whichskew the test statistics and decrease the test’s power by increasing the estimated standard error.
3.1.3 W ILCOXON S IGNED -R ANKS T EST
The Wilcoxon signed-ranks test (Wilcoxon, 1945) is a non-parametric alternative to the paired t-test,
which ranks the differences in performances of two classifiers for each data set, ignoring the signs,
and compares the ranks for the positive and the negative differences.
Let di again be the difference between the performance scores of the two classifiers on i-th outof N data sets. The differences are ranked according to their absolute values; average ranks are
assigned in case of ties. Let R+ be the sum of ranks for the data sets on which the second algorithm
outperformed the first, and R− the sum of ranks for the opposite. Ranks of di = 0 are split evenly
among the sums; if there is an odd number of them, one is ignored:
R+ = ∑ rank(di ) +di >0

1
rank(di )
2 d∑
i =0

R− = ∑ rank(di ) +di <01rank(di ).
2 d∑
i =0

Let T be the smaller of the sums, T = min(R+ , R− ). Most books on general statistics include atable of exact critical values for T for N up to 25 (or sometimes more). For a larger number of data
sets, the statistics
T − 41 N(N + 1)z= q
1
24 N(N + 1)(2N + 1)

is distributed approximately normally. With α = 0.05, the null-hypothesis can be rejected if z issmaller than −1.96.
7

D EM ŠAR

Let us illustrate the procedure on an example. Table 2 shows the comparison of AUC for C4.5
with m (the minimal number of examples in a leaf) set to zero and C4.5 with m tuned for the optimal AUC. For the latter, AUC has been computed with 5-fold internal cross validation on training
examples for m∈ {0, 1, 2, 3, 5, 10, 15, 20, 50}. The experiments were performed on 14 data sets fromthe UCI repository with binary class attribute. We used the original Quinlan’s C4.5 code, equippedwith an interface that integrates it into machine learning system Orange (Demšar and Zupan, 2004),
which provided us with the cross validation procedures, classes for tuning arguments, and the scoring functions. We are trying to reject the null-hypothesis that both algorithms perform equally well.
There are two data sets on which the classifiers performed equally (lung-cancer and mushroom);
if there was an odd number of them, we would ignore one. The ranks are assigned from the lowest
to the highest absolute difference, and the equal differences (0.000, ±0.005) are assigned averageranks.
The sum of ranks for the positive differences is R+ = 3.5 + 9 + 12 + 5 + 6 + 14 + 11 + 13 + 8 +10 + 1.5 = 93 and the sum of ranks for the negative differences equals R− = 7 + 3.5 + 1.5 = 12.
According to the table of exact critical values for the Wilcoxon’s test, for a confidence level of
α = 0.05 and N = 14 data sets, the difference between the classifiers is significant if the smaller ofthe sums is equal or less than 21. We therefore reject the null-hypothesis.
The Wilcoxon signed ranks test is more sensible than the t-test. It assumes commensurability ofdifferences, but only qualitatively: greater differences still count more, which is probably desired,
but the absolute magnitudes are ignored. From the statistical point of view, the test is safer since itdoes not assume normal distributions. Also, the outliers (exceptionally good/bad performances ona few data sets) have less effect on the Wilcoxon than on the t-test.
The Wilcoxon test assumes continuous differences di , therefore they should not be rounded to,say, one or two decimals since this would decrease the power of the test due to a high number ofties.
When the assumptions of the paired t-test are met, the Wilcoxon signed-ranks test is less powerful than the paired t-test. On the other hand, when the assumptions are violated, the Wilcoxon test
can be even more powerful than the t-test.
3.1.4 C OUNTS OF W INS , L OSSES AND T IES : S IGN T EST
A popular way to compare the overall performances of classifiers is to count the number of data
sets on which an algorithm is the overall winner. When multiple algorithms are compared, pairwise
comparisons are sometimes organized in a matrix.
Some authors also use these counts in inferential statistics, with a form of binomial test thatis known as the sign test (Sheskin, 2000; Salzberg, 1997). If the two algorithms compared are, asassumed under the null-hypothesis, equivalent, each should win on approximately N/2 out of N data
sets. The number of wins is distributed according to the binomial distribution; the critical numberof wins can be found in Table 3. For a greater number√ of data sets, the number of wins is underz-test: if
the null-hypothesis distributed according to√ N(N/2, N/2), which allows for the use of √the number of wins is at least N/2 + 1.96 N/2 (or, for a quick rule of a thumb, N/2 + N), thealgorithm is significantly better with p < 0.05. Since tied matches support the null-hypothesis weshould not discount them but split them evenly between the two classifiers; if there is an odd numberof them, we again ignore one.
8

S TATISTICAL C OMPARISONS OF C LASSIFIERS OVER M ULTIPLE DATA S ETS#data sets
w0.05
w0.10

5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
5 6 7 7 8 9 9 10 10 11 12 12 13 13 14 15 15 16 17 18 18
5 6 6 7 7 8 9 9 10 10 11 12 12 13 13 14 14 15 16 16 17

Table 3: Critical values for the two-tailed sign test at α = 0.05 and α = 0.10. A classifier is significantly better than another if it performs better on at least wα data sets.

In example from Table 2, C4.5+m was better on 11 out of 14 data sets (counting also one of
the two data sets on which the two classifiers were tied). According to Table 3 this difference issignificant with p < 0.05.
This test does not assume any commensurability of scores or differences nor does it assume
normal distributions and is thus applicable to any data (as long as the observations, i.e. the data
sets, are independent). On the other hand, it is much weaker than the Wilcoxon signed-ranks test.
According to Table 3, the sign test will not reject the null-hypothesis unless one algorithm almost
always outperforms the other.
Some authors prefer to count only the significant wins and losses, where the significance isdetermined using a statistical test on each data set, for instance Dietterich’s 5×2cv. The reasoning
behind this practice is that “some wins and losses are random and these should not count”. This
would be a valid argument if statistical tests could distinguish between the random and non-random
differences. However, statistical tests only measure the improbability of the obtained experimental
result if the null hypothesis was correct, which is not even the (im)probability of the null-hypothesis.
For the sake of argument, suppose that we compared two algorithms on one thousand different
data sets. In each and every case, algorithm A was better than algorithm B, but the difference wasnever significant. It is true that for each single case the difference between the two algorithms canbe attributed to a random chance, but how likely is it that one algorithm was just lucky in all 1000
out of 1000 independent experiments?
Contrary to the popular belief, counting only significant wins and losses therefore does not makethe tests more but rather less reliable, since it draws an arbitrary threshold of p < 0.05 between whatcounts and what does not.
3.2 Comparisons of Multiple Classifiers
None of the above tests was designed for reasoning about the means of multiple random variables.
Many authors of machine learning papers nevertheless use them for that purpose. A common example of such questionable procedure would be comparing seven algorithms by conducting all 21
paired t-tests and reporting results like “algorithm A was found significantly better than B and C,
and algorithms A and E were significantly better than D, while there were no significant differences
between other pairs”. When so many tests are made, a certain proportion of the null hypotheses isrejected due to random chance, so listing them makes little sense.
The issue of multiple hypothesis testing is a well-known statistical problem. The usual goal is
to control the family-wise error, the probability of making at least one Type 1 error in any of thecomparisons. In machine learning literature, Salzberg (1997) mentions a general solution for the9

D EM ŠAR

problem of multiple testing, the Bonferroni correction, and notes that it is usually very conservative
and weak since it supposes the independence of the hypotheses.
Statistics offers more powerful specialized procedures for testing the significance of differences
between multiple means. In our situation, the most interesting two are the well-known ANOVA
and its non-parametric counterpart, the Friedman test. The latter, and especially its corresponding
Nemenyi post-hoc test are less known and the literature on them is less abundant; for this reason,
we present them in more detail.
3.2.1 ANOVA
The common statistical method for testing the differences between more than two related sample
means is the repeated-measures ANOVA (or within-subjects ANOVA) (Fisher, 1959). The “related
samples” are again the performances of the classifiers measured across the same data sets, preferablyusing the same splits onto training and testing sets. The null-hypothesis being tested is that allclassifiers perform the same and the observed differences are merely random.
ANOVA divides the total variability into the variability between the classifiers, variability between the data sets and the residual (error) variability. If the between-classifiers variability is significantly larger than the error variability, we can reject the null-hypothesis and conclude that there aresome differences between the classifiers. In this case, we can proceed with a post-hoc test to findout which classifiers actually differ. Of many such tests for ANOVA, the two most suitable for oursituation are the Tukey test (Tukey, 1949) for comparing all classifiers with each other and the Dunnett test (Dunnett, 1980) for comparisons of all classifiers with the control (for instance, comparing
the base classifier and some proposed improvements, or comparing the newly proposed classifier
with several existing methods). Both procedures compute the standard error of the difference between two classifiers by dividing the residual variance by the number of data sets. To make pairwise
comparisons between the classifiers, the corresponding differences in performances are divided by
the standard error and compared with the critical value. The two procedures are thus similar to at-test, except that the critical values tabulated by Tukey and Dunnett are higher to ensure that there
is at most 5 % chance that one of the pairwise differences will be erroneously found significant.
Unfortunately, ANOVA is based on assumptions which are most probably violated when analyzing the performance of machine learning algorithms. First, ANOVA assumes that the samples
are drawn from normal distributions. In general, there is no guarantee for normality of classification
accuracy distributions across a set of problems. Admittedly, even if distributions are abnormal thisis a minor problem and many statisticians would not object to using ANOVA unless the distributions
were, for instance, clearly bi-modal (Hamilton, 1990). The second and more important assumptionof the repeated-measures ANOVA is sphericity (a property similar to the homogeneity of variancein the usual ANOVA, which requires that the random variables have equal variance). Due to thenature of the learning algorithms and data sets this cannot be taken for granted. Violations of theseassumptions have an even greater effect on the post-hoc tests. ANOVA therefore does not seem tobe a suitable omnibus test for the typical machine learning studies.
We will not describe ANOVA and its post-hoc tests in more details due to our reservations about
the parametric tests and, especially, since these tests are well known and described in statistical
literature (Zar, 1998; Sheskin, 2000).
10S TATISTICAL C OMPARISONS OF C LASSIFIERS OVER M ULTIPLE DATA S ETSFriedmantest

p < 0.01
0.01 ≤ p ≤ 0.05
0.05 < p

ANOVA
p < 0.01
16
4
00.01 ≤ p ≤ 0.05
1
1
2

0.05 < p0
4
28

Table 4: Friedman’s comparison of his test and the repeated-measures ANOVA on 56 independentproblems (Friedman, 1940).

3.2.2 F RIEDMAN T ESTThe Friedman test (Friedman, 1937, 1940) is a non-parametric equivalent of the repeated-measures
ANOVA. It ranks the algorithms for each data set separately, the best performing algorithm getting
the rank of 1, the second best rank 2. . . , as shown in Table 6. In case of ties (like in iris, lung cancer,
mushroom and primary tumor), average ranks are assigned.
j
Let ri be the rank of the j-th of k algorithms on the i-th of N data sets. The Friedman testjcompares the average ranks of algorithms, R j = N1 ∑i ri . Under the null-hypothesis, which statesthat all the algorithms are equivalent and so their ranks R j should be equal, the Friedman statistic"#
12N
k(k + 1)2
2
2
χF =
Rj −
k(k + 1) ∑4
jis distributed according to χ2F with k − 1 degrees of freedom, when N and k are big enough (as arule of a thumb, N > 10 and k > 5). For a smaller number of algorithms and data sets, exact criticalvalues have been computed (Zar, 1998; Sheskin, 2000).
Iman and Davenport (1980) showed that Friedman’s χ2F is undesirably conservative and derived
a better statistic(N − 1)χ2F
FF =N(k − 1) − χ2F

which is distributed according to the F-distribution with k −1 and (k −1)(N −1) degrees of freedom.
The table of critical values can be found in any statistical book.
As for the two-classifier comparisons, the (non-parametric) Friedman test has theoretically lesspower than (parametric) ANOVA when the ANOVA’s assumptions are met, but this does not need
to be the case when they are not. Friedman (1940) experimentally compared ANOVA and his teston 56 independent problems and showed that the two methods mostly agree (Table 4). When one
method finds significance at p < 0.01, the other shows significance of at least p < 0.05. Only in 2
cases did ANOVA find significant what was insignificant for Friedman, while the opposite happened
in 4 cases.
If the null-hypothesis is rejected, we can proceed with a post-hoc test. The Nemenyi test (Nemenyi, 1963) is similar to the Tukey test for ANOVA and is used when all classifiers are compared toeach other. The performance of two classifiers is significantly different if the corresponding averageranks differ by at least the critical differencerk(k + 1)
CD = qα
6N
11

D EM ŠAR

#classifiers
q0.05
q0.10

2
1.960
1.645

3
2.343
2.052

4
2.569
2.291

5
2.728
2.459

6
2.850
2.589

7
2.949
2.693

8
3.031
2.780

9
3.102
2.855

10
3.164
2.920

8
2.690
2.450

9
2.724
2.498

10
2.773
2.539

(a) Critical values for the two-tailed Nemenyi test#classifiers
q0.05
q0.10

2
1.960
1.645

3
2.241
1.960

4
2.394
2.128

5
2.498
2.241

6
2.576
2.326

7
2.638
2.394

(b) Critical values for the two-tailed Bonferroni-Dunn test; the number of classifiers include the control
classifier.

Table 5: Critical values for post-hoc tests after the Friedman test√
where critical values qα are based on the Studentized range statistic divided by 2 (Table 5(a)).
When all classifiers are compared with a control classifier, we can instead of the Nemenyi test
use one of the general procedures for controlling the family-wise error in multiple hypothesis testing, such as the Bonferroni correction or similar procedures. Although these methods are generally
conservative and can have little power, they are in this specific case more powerful than the Nemenyi test, since the latter adjusts the critical value for making k(k − 1)/2 comparisons while whencomparing with a control we only make k − 1 comparisons.
The test statistics for comparing the i-th and j-th classifier using these methods isz = (Ri − R j ),rk(k + 1).
6N

The z value is used to find the corresponding probability from the table of normal distribution, whichis then compared with an appropriate α. The tests differ in the way they adjust the value of α tocompensate for multiple comparisons.
The Bonferroni-Dunn test (Dunn, 1961) controls the family-wise error rate by dividing α by the
number of comparisons made (k − 1, in our case). The alternative way to compute the same test is
to calculate the CD using the same equation as for the Nemenyi test, but using the critical values
for α/(k − 1) (for convenience, they are given in Table 5(b)). The comparison between the tables
for Nemenyi’s and Dunn’s test shows that the power of the post-hoc test is much greater when allclassifiers are compared only to a control classifier and not between themselves. We thus should not
make pairwise comparisons when we in fact only test whether a newly proposed method is better
than the existing ones.
For a contrast from the single-step Bonferroni-Dunn procedure, step-up and step-down procedures sequentially test the hypotheses ordered by their significance. We will denote the ordered p
values by p1 , p2 , ..., so that p1 ≤ p2 ≤ . . . ≤ pk−1 . The simplest such methods are due to Holm
(1979) and Hochberg (1988). They both compare each pi with α/(k − i), but differ in the order
12

S TATISTICAL C OMPARISONS OF C LASSIFIERS OVER M ULTIPLE DATA S ETSof the tests.1 Holm’s step-down procedure starts with the most significant p value. If p1 is below α/(k − 1), the corresponding hypothesis is rejected and we are allowed to compare p2 withα/(k − 2). If the second hypothesis is rejected, the test proceeds with the third, and so on. As soon
as a certain null hypothesis cannot be rejected, all the remaining hypotheses are retained as well.
Hochberg’s step-up procedure works in the opposite direction, comparing the largest p value with α,
the next largest with α/2 and so forth until it encounters a hypothesis it can reject. All hypotheseswith smaller p values are then rejected as well.
Hommel’s procedure (Hommel, 1988) is more complicated to compute and understand. First,
we need to find the largest j for which pn− j+k > kα/ j for all k = 1.. j. If no such j exists, we canreject all hypotheses, otherwise we reject all for which pi ≤ α/ j.
Holm’s procedure is more powerful than the Bonferroni-Dunn’s and makes no additional assumptions about the hypotheses tested. The only advantage of the Bonferroni-Dunn test seems tobe that it is easier to describe and visualize because it uses the same CD for all comparisons. In turn,
Hochberg’s and Hommel’s methods reject more hypotheses than Holm’s, yet they may under somecircumstances exceed the prescribed family-wise error since they are based on the Simes conjecture
which is still being investigated. It has been reported (Holland, 1991) that the differences between
the enhanced methods are in practice rather small, therefore the more complex Hommel method
offers no great advantage over the simple Holm method.
Although we here use these procedures only as post-hoc tests for the Friedman test, they can beused generally for controlling the family-wise error when multiple hypotheses of possibly various
types are tested. There exist other similar methods, as well as some methods that instead of controlling the family-wise error control the number of falsely rejected null-hypotheses (false discovery
rate, FDR). The latter are less suitable for the evaluation of machine learning algorithms since theyrequire the researcher to decide for the acceptable false discovery rate. A more complete formal
description and discussion of all these procedures was written, for instance, by Shaffer (1995).
Sometimes the Friedman test reports a significant difference but the post-hoc test fails to detect
it. This is due to the lower power of the latter. No other conclusions than that some algorithms do
differ can be drawn in this case. In our experiments this has, however, occurred only in a few cases
out of one thousand.
The procedure is illustrated by the data from Table 6, which compares four algorithms: C4.5
with m fixed to 0 and cf (confidence interval) to 0.25, C4.5 with m fitted in 5-fold internal crossvalidation, C4.5 with cf fitted the same way and, finally, C4.5 in which we fitted both arguments,
trying all combinations of their values. Parameter m was set to 0, 1, 2, 3, 5, 10, 15, 20, 50 and cf to0, 0.1, 0.25 and 0.5.
Average ranks by themselves provide a fair comparison of the algorithms. On average, C4.5+mand C4.5+m+cf ranked the second (with ranks 2.000 and 1.964, respectively), and C4.5 and C4.5+cf
the third (3.143 and 2.893). The Friedman test checks whether the measured average ranks are
significantly different from the mean rank R j = 2.5 expected under the null-hypothesis:
12 · 144 · 52
2
2
2
2
2
χF =
(3.143 + 2.000 + 2.893 + 1.964 ) −= 9.284·54FF=

13 · 9.28= 3.69.
14 · 3 − 9.28

1. In the usual definitions of these procedures k would denote the number of hypotheses, while in our case the numberof hypotheses is k − 1, hence the differences in the formulae.

13

D EM ŠAR

adult (sample)
breast cancer
breast cancer wisconsin
cmc
ionosphereiris
liver disorders
lung cancer
lymphography
mushroom
primary tumor
rheum
votingwine
average rank

C4.5
0.763 (4)0.599 (1)0.954 (4)0.628 (4)0.882 (4)0.936 (1)0.661 (3)0.583 (2.5)
0.775 (4)1.000 (2.5)
0.940 (4)0.619 (3)0.972 (4)0.957 (3)
3.143

C4.5+m0.768 (3)0.591 (2)0.971 (1)0.661 (1)0.888 (2)0.931 (2.5)
0.668 (2)0.583 (2.5)
0.838 (3)1.000 (2.5)
0.962 (2.5)
0.666 (2)0.981 (1)0.978 (1)2.000

C4.5+cf
0.771 (2)0.590 (3)0.968 (2)0.654 (3)0.886 (3)0.916 (4)0.609 (4)0.563 (4)0.866 (2)1.000 (2.5)
0.965 (1)0.614 (4)0.975 (2)0.946 (4)2.893

C4.5+m+cf
0.798 (1)0.569 (4)0.967 (3)0.657 (2)0.898 (1)0.931 (2.5)
0.685 (1)0.625 (1)0.875 (1)1.000 (2.5)
0.962 (2.5)
0.669 (1)0.975 (3)0.970 (2)1.964

Table 6: Comparison of AUC between C4.5 with m = 0 and C4.5 with parameters m and/or cf tuned
for the optimal AUC. The ranks in the parentheses are used in computation of the Friedman
test and would usually not be published in an actual paper.

With four algorithms and 14 data sets, FF is distributed according to the F distribution with
4−1 = 3 and (4−1)×(14−1) = 39 degrees of freedom. The critical value of F(3, 39) for α = 0.05
is 2.85, so we reject the null-hypothesis.
Further analysis depends upon what we intended to study. If no classifier is singled out, we
use the Nemenyi test for pairwise
comparisons. The critical value (Table 5(a)) is 2.569 and theq

4·5= 1.25. Since even the difference between the best and the worst
corresponding CD is 2.569 6·14
performing algorithm is already smaller than that, we can conclude that the post-hoc test is not
powerful enough to detect any significant differences between the algorithms.
q4·5
At p=0.10, CD is 2.291 6·14
= 1.12. We can identify two groups of algorithms: the performance of pure C4.5 is significantly worse than that of C4.5+m and C4.5+m+cf. We cannot tellwhich group C4.5+cf belongs to. Concluding that it belongs to both would be a statistical nonsense
since a subject cannot come from two different populations. The correct statistical statement would
be that the experimental data is not sufficient to reach any conclusion regarding C4.5+cf.
The other possible hypothesis made before collecting the data could be that it is possible toimprove on C4.5’s performance by tuning its parameters. The easiest way to verify this is to compute
the CD with the Bonferroni-Dunn test.
q In Table 5(b) we find that the critical value q0.05 for 4
4·5classifiers is 2.394, so CD is 2.394 6·14
= 1.16. C4.5+m+cf performs significantly better thanC4.5 (3.143 − 1.964 = 1.179 > 1.16) and C4.5+cf does not (3.143 − 2.893 = 0.250 < 1.16), while
C4.5+m is just below the critical difference, but close to it (3.143 − 2.000 = 1.143 ≈ 1.16). We
can conclude that the experiments showed that fitting m seems to help, while we did not detect any
significant improvement by fitting cf.
For the other tests weq have to compute and order the corresponding statistics and p values. The

standard error is SE =4·5
6·14 = 0.488.

14

S TATISTICAL C OMPARISONS OF C LASSIFIERS OVER M ULTIPLE DATA S ETS

i

1
2
3

classifier
C4.5+m+cf
C4.5+m
C4.5+cfz = (R0 − Ri )/SE
(3.143 − 1.964)/0.488 = 2.416(3.143 − 2.000)/0.488 = 2.342(3.143 − 2.893)/0.488 = 0.512

p
0.016
0.019
0.607

α/i
0.017
0.025
0.050

The Holm procedure rejects the first and then the second hypothesis since the corresponding pvalues are smaller than the adjusted α’s. The third hypothesis cannot be rejected; if there were any
more, we would have to retain them, too.
The Hochberg procedure starts from the bottom. Unable to reject the last hypothesis, it checkthe second last, rejects it and among with it all the hypotheses with smaller p values (the top-mostone).
Finally, the Hommel procedure finds that j = 3 does not satisfy the condition at k = 2. The
maximal value of j is 2, and the first two hypotheses can be rejected since their p values are below
α/2.
All step-down and step-up procedure found C4.5+cf+m and C4.5+m significantly different fromC4.5, while the Bonferroni-Dunn test found C4.5 and C4.5+m too similar.
3.2.3 C ONSIDERING M ULTIPLE R EPETITIONS OF E XPERIMENTS
In our examples we have used AUCs measured and averaged over repetitions of training/testing
episodes. For instance, each cell in Table 6 represents an average over five-fold cross validation.
Could we also consider the variance, or even the results of individual folds?
There are variations of the ANOVA and the Friedman test which can consider multiple observations per cell provided that the observations are independent (Zar, 1998). This is not the case here,
since training data in multiple random samples overlaps. We are not aware of any statistical test that
could take this into account.
3.2.4 G RAPHICAL P RESENTATION OF R ESULTS
When multiple classifiers are compared, the results of the post-hoc tests can be visually represented
with a simple diagram. Figure 1 shows the results of the analysis of the data from Table 6. The top
line in the diagram is the axis on which we plot the average ranks of methods. The axis is turned sothat the lowest (best) ranks are to the right since we perceive the methods on the right side as better.
When comparing all the algorithms against each other, we connect the groups of algorithms thatare not significantly different (Figure 1(a)). We also show the critical difference above the graph.
If the methods are compared to the control using the Bonferroni-Dunn test we can mark theinterval of one CD to the left and right of the average rank of the control algorithm (Figure 1(b)).
Any algorithm with the rank outside this area is significantly different from the control. Similargraphs for the other post-hoc tests would need to plot a different adjusted critical interval for eachclassifier and specify the procedure used for testing and the corresponding order of comparisons,which could easily become confusing.
For another example, Figure 2 graphically represents the comparison of feature scoring measures for the problem of keyword prediction on five domains formed from the Yahoo hierarchy
studied by Mladenić and Grobelnik (1999). The analysis reveals that Information gain performs
significantly worse than Weight of evidence, Cross entropy Txt and Odds ratio, which seem to have15

D EM ŠAR

CD.......................................................................................

4
C4.5
C4.5+cf321......
......
....
.......................................................................................
....
...
.......................................................................................

...
...
...
...
...
...
...............................................................................................
...
...
..
..............................................................................

C4.5+m+cf
C4.5+m(a) Comparison of all classifiers against each other with the Nemenyi test. Groups of classifiers that are notsignificantly different (at p = 0.10) are connected.

4C4.5
C4.5+cf

3

2

...
....
...
..
..............................................................................

1......
......
......
......................................................................................
...
...
.......................................................................................

...
...
...
...
...
...
..............................................................................................

C4.5+m+cf
C4.5+m(b) Comparison of one classifier against the others with the Bonferroni-Dunn test. All classifiers with ranks outside
the marked interval are significantly different (p < 0.05) from the control.

Figure 1: Visualization of post-hoc tests for data from Table 6.
CD.......................................................................................................

6

Information gain
Mutual information Txt
Term frequency

5

4

3

...
...
...
...
...
...
...
...
...
...
...
...
..
.........................................................................................................................

...
...
...
...
...
...
...
...
...
.
......................................................
...
...
...
...
...
...
..........

2

1

...
...
...
...
...
...
...
...
...
...
...
...
............................
...
...
.....
...............................................................................
...
...
..............................................................................

Odds ratio
Cross entropy Txt
Weight of evidence for text

Figure 2: Comparison of recalls for various feature selection measures; analysis of the results fromthe paper by Mladenić and Grobelnik (1999).

equivalent performances. The data is not sufficient to conclude whether Mutual information Txt
performs the same as Information gain or Term Frequency, and similarly, whether Term Frequency
is equivalent to Mutual information Txt or to the better three methods.

4. Empirical Comparison of Tests
We experimentally observed two properties of the described tests: their replicability and the likelihood of rejecting the null-hypothesis. Performing the experiments to answer questions like “which
statistical test is most likely to give the correct result” or “which test has the lowest Type 1/Type 2
error rate” would be a pointless exercise since the proposed inferential tests suppose different kinds
16

S TATISTICAL C OMPARISONS OF C LASSIFIERS OVER M ULTIPLE DATA S ETS

of commensurability and thus compare the classifiers from different aspects. The “correct answer”,
rejection or non-rejection of the null-hypothesis, is thus not well determined and is, in a sense,
related to the choice of the test.
4.1 Experimental Setup
We examined the behaviour of the studied tests through the experiments in which we repeatedly
compared the learning algorithms on sets of ten randomly drawn data sets and recorded the p values
returned by the tests.
4.1.1 DATA S ETS AND L EARNING A LGORITHMS
We based our experiments on several common learning algorithms and their variations: C4.5, C4.5
with m and C4.5 with cf fitted for optimal accuracy, another tree learning algorithm implemented inOrange (with features similar to the original C4.5), naive Bayesian learner that models continuous
probabilities using LOESS (Cleveland, 1979), naive Bayesian learner with continuous attributes
discretized using Fayyad-Irani’s discretization (Fayyad and Irani, 1993) and kNN (k=10, neighbour
weights adjusted with the Gaussian kernel).
We have compiled a sample of forty real-world data sets,2 from the UCI machine learning
repository (Blake and Merz, 1998); we have used the data sets with discrete classes and avoided
artificial data sets like Monk problems. Since no classifier is optimal for all possible data sets,
we have simulated experiments in which a researcher wants to show particular advantages of aparticular algorithm and thus selects a corresponding compendium of data sets. We did this bymeasuring the classification accuracies of the classifiers on all data sets in advance by using ten-foldcross validation. When comparing two classifiers, samples of ten data sets were randomly selected
so that the probability for the data set i being chosen was proportional to 1/(1 + e−kdi ), where di isthe (positive or negative) difference in the classification accuracies on that data set and k is the bias
through which we can regulate the differences between the classifiers.3 Whereas at k = 0 the data
set selection is random with the uniform distribution, with higher values of k we are more likely
to select the sets that favour a particular learning method. Note that choosing the data sets withknowing their success (as estimated in advance) is only a simulation, while the researcher would
select the data sets according to other criteria. Using the described procedure in practical evaluationsof algorithms would be considered cheating.
We decided to avoid “artificial” classifiers and data sets constructed specifically for testing thestatistical tests, such as those used, for instance, by Dietterich (1998). In such experimental procedures some assumptions need to be made about the real-world data sets and the learning algorithms,
and the artificial data and algorithms are constructed in a way that mimics the supposed real-world
situation in a controllable manner. In our case, we would construct two or more classifiers witha prescribed probability of failure over a set of (possible imaginary) data sets so that we could,
2. The data sets used are: adult, balance-scale, bands, breast cancer (haberman), breast cancer (lju), breast cancer(wisc), car evaluation, contraceptive method choice, credit screening, dermatology, ecoli, glass identification, hayesroth, hepatitis, housing, imports-85, ionosphere, iris, liver disorders, lung cancer, lymphography, mushrooms, pima
indians diabetes, post-operative, primary tumor, promoters, rheumatism, servo, shuttle landing, soybean, spambase,spect, spectf, teaching assistant evaluation, tic tac toe, titanic, voting, waveform, wine recognition, yeast.
3. The function used is the logistic function. It was chosen for its convenient shape; we do not claim that such relation
actually occurs in practice when selecting the data sets for experiments.

17

D EM ŠAR

knowing the correct hypothesis, observe the Type 1 and 2 error rates of the proposed statisticaltests.
Unfortunately, we do not know what should be our assumptions about the real world. To what
extent are the classification accuracies (or other measures of success) incommensurable? How(ab)normal is their distribution? How homogenous is the variance? Moreover, if we do makecertain assumptions, the statistical theory is already able to tell the results of the experiments that
we are setting up. Since the statistical tests which we use are theoretically well understood, we do
not need to test the tests but the compliance of the real-world data to their assumptions. In otherwords, we know, from the theory, that the t-test on a small sample (that is, on a small number ofdata sets) requires the normal distribution, so by constructing an artificial environment that will
yield non-normal distributions we can make the t-test fail. The real question however is whether thereal world distributions are normal enough for the t-test to work.
Cannot we test the assumptions directly? As already mentioned in the description of the t-test,
the tests like the Kolmogorov-Smirnov test of normality are unreliable on small samples where they
are very unlikely to detect abnormalities. And even if we did have suitable tests at our disposal, theywould only compute the degree of (ab)normality of the distribution, non-homogeneity of varianceetc, and not the sample’s suitability for t-test.
Our decision to use real-world learning algorithms and data sets in unmodified form prevents
us from artificially setting the differences between them by making them intentionally misclassify
a certain proportion of examples. This is however compensated by our method of selecting thedata sets: we can regulate the differences between the learning algorithms by affecting the data
set selection through regulating the bias k. In this way, we perform the experiments on real-world
data sets and algorithms, and yet observe the performance of the statistics at various degrees ofdifferences between the classifiers.
4.1.2 M EASURES OF P OWER AND R EPLICABILITY
Formally, the power of a statistical test is defined as the probability that the test will (correctly) reject
the false null-hypothesis. Since our criterion of what is actually false is related to the selection of thetest (which should be based on the kind of differences between the classifiers we want to measure),
we can only observe the probability of the rejection of the null-hypothesis, which is neverthelessrelated to the power.
We do this in two ways. First, we set the significance level at 5% and observe in how many
experiments out of one thousand does a particular test reject the null-hypothesis. The shortcomingof this is that it observes only the behaviour of statistics at around p = 0.05 (which is probably what
we are interested in), yet it can miss a bigger picture. We therefore also observed the average pvalues as another measure of “power” of the test: the lower the values, the more likely it is for a test
to reject the null-hypothesis at a set confidence level.
The two measures for assessing the power of the tests lead to two related measures of replicability. Bouckaert (2004) proposed a definition which can be used in conjuction with counting therejections of the null-hypothesis. He defined the replicability as the probability that two experimentswith the same pair of algorithms will produce the same results, that is, that both experiments accept
or reject the null-hypothesis, and devised the optimal unbiased estimator of this probability,
R(e) =

I(ei = e j )1≤i< j≤n n(n − 1)/2∑

18

S TATISTICAL C OMPARISONS OF C LASSIFIERS OVER M ULTIPLE DATA S ETS

where ei is the outcome of the i-th experiment out of n (ei is 1 if the null-hypothesis is accepted, 0 if
it is not) and I is the indicator function which is 1 if its argument is true and 0 otherwise. Bouckaert
also describes a simpler way to compute R(e): if the hypothesis was accepted in p and rejected inq experiments out of n, R(e) equals (p(p − 1) + q(q − 1))/n(n − 1). The minimal value of R, 0.5,
occurs when p = q = n/2, and the maximal, 1.0, when either p or q is zero.
The disadvantage of this measure is that a statistical test will show a low replicability when the
difference between the classifiers is marginally significant. When comparing two tests of different
power, the one with results closer to the chosen α will usually be deemed as less reliable.
When the power is estimated by the average of p values, the replicability is naturally defined
through their variance. The variance of p is between 0 and 0.25; the latter occurs when one half ofp’s equals zero and the other half equals one.4 To allow for comparisons with Bouckaert’s R(e), we
define the replicability with respect to the variance of p as
R(p) = 1 − 2 · var(p) = 1 − 2∑i (pi − p)2.
n−1

A problem with this measure of replicability when used in our experimental procedure is thatwhen the bias k increases, the variability of the data set selection decreases and so does the varianceof p. The size of the effect depends on the number of data sets. Judged by the results of theexperiments, our collection of forty data sets is large enough to keep the variability practicallyunaffected for the used values of k (see the left graph in Figure 4.c; if the variability of selections
decreased, the variance of p could not remain constant).
The described definitions of replicability are related. Since I(ei = e j ) equals 1 − (ei − e j )2 , we
can reformulate R(e) as
R(e) =(ei − e j )2((ei − e) − (e j − e))2
1 − (ei − e j )2
= 1−∑∑= 1−∑∑.
n(n − 1)i j n(n − 1)i j1≤i< j≤n n(n − 1)/2∑

From here, it is easy to verify that
R(e) = 1 − 2∑i (ei − e)2.
n−1

The fact that Bouckaert’s formula is the optimal unbiased estimator for R(e) is related to ∑i (ei −e)2 /(n − 1) being the optimal unbiased estimator of the population variance.
4.2 Comparisons of Two Classifiers
We have tested four statistics for comparisons of two classifiers: the paired t-test on absolute and on
relative differences, the Wilcoxon test and the sign test. The experiments were run on 1000 random
selections of ten data sets, as described above.
The graphs on the left hand side of Figure 3 show the average p values returned by the tests asa function of the bias k when comparing C4.5-cf, naive Bayesian classifier and kNN (note that thescale is turned upside down so the curve rises when the power of the test increases). The graphson the right hand side show the number of experiments in which the hypothesis was rejected at
4. Since we estimate the population variance from the sample variance, the estimated variance will be higher by
0.25/(n − 1). With any decent number of experiments, the difference is however negligible.

19

D EM ŠAR

α = 5%. To demonstrate the relation between power (as we measure it) and Bouckaert’s measure of
replicability we have added the right axis that shows R(e) corresponding to the number of rejected
hypothesis.
Note that at k = 0 the number of experiments in which the null hypothesis is rejected is not 50%.
Lower settings of k do not imply that both algorithms compared should perform approximately
equally, but only that we do not (artificially) bias the data sets selection to favour one of them.
Therefore, at k = 0 the tests reflect the number of rejections of the null-hypothesis on a completely
random selection of data sets from our collection.
Both variations of the t-test give similar results, with the test on relative differences beingslightly, yet consistently weaker. The Wilcoxon signed-ranks test gives much lower p values and ismore likely to reject the null-hypothesis than t-tests in almost all cases. The sign test is, as known
from the theory, much weaker than the other tests.
The two measures of replicability give quite different results. Judged by R(p) (graphs on theleft hand side of Figure 4), the Wilcoxon test exhibits the smallest variation of p values. For acontrast, Bouckaert’s R(e) (right hand side of Figure 4) shows the Wilcoxon test as the least reliable.
However, the shape of the curves on these graphs and the right axes in Figure 3 clearly show thatthe test is less reliable (according to R(e)) when the p values are closer to 0.05, so the Wilcoxon test
seems unreliable due to its higher power keeping it closer to p=0.05 than the other tests.
Table 7 shows comparisons of all seven classifiers with k set to 15. The numbers below thediagonal show the average p values and the related replicability R(p), and the numbers above thediagonal represent the number of experiments in which the null-hypothesis was rejected at α = 5%
and the related R(e). The table again shows that the Wilcoxon test almost always returns lower pvalues than other tests and more often rejects the null hypothesis. Measured by R(p), the Wilcoxon
test also has the highest replicability. R(e), on the other hand, again prefers other tests with p values
farther from the critical 0.05.
Overall, it is known that parametric tests are more likely to reject the null-hypothesis than the
non-parametric unless their assumptions are violated. Our results suggest that the latter is indeed
happening in machine learning studies that compare algorithms across collections of data sets. We
therefore recommend using the Wilcoxon test, unless the t-test assumptions are met, either because
we have many data sets or because we have reasons to believe that the measure of performanceacross data sets is distributed normally. The sign test, as the third alternative, is too weak to begenerally useful.
Low values of R(e) suggest that we should ensure the reliability of the results (especially when
the differences between classifiers are marginally significant) by running the experiments on as
many appropriate data sets as possible.
4.3 Comparisons of Multiple Classifiers
For comparison of multiple classifiers, samples of data sets were selected with the probabilities
computed from the differences in the classification accuracy of C4.5 and naive Bayesian classifier
with Fayyad-Irani discretization. These two classifiers were chosen for no particular reason; wehave verified that the choice has no practical effect on the results.
Results are shown in Figure 5. When the algorithms are more similar (at smaller values of k),
the non-parametric Friedman test again appears stronger than the parametric, ANOVA. At greater
20

S TATISTICAL C OMPARISONS OF C LASSIFIERS OVER M ULTIPLE DATA S ETS+...........................

±

T-test...........................

0.10
0.15
0.20
0.25
0.30

...........................

×

Wilcoxon...........................

Sign test

1000

0.00
0.05



T-test (rel)



....
...........
..............
............
........
..........
.
.
.
.
.....
............
.............
........
.....
........
....
...........
....
.........
.
.
.
.
.
.
.
.
.
.
.
.
.
..
......
.......
.....
.....
..........
..........
....
..........
.....
.....
.............
.....
....
.
........
.
.
.
..
........
.
.
..
.
.
.
.
.
.
.
.
.
.
..
.......
........
...
.......
........
...
...
....
.......
..
...
.....
.....
...
...
....
.....
.
.
.
.
.
.
.
.
.
.
.
...
....
...
...
....
..........
...
... ..........
.....
....
.....
... ...
.....
......
.
.
.. ....
...
.
.
.
.
.
....
... ....
...
....
...
...
... ...
..
.. ...
..
....
..
... ....
.
.
.
.
.
.
.
.
.
..
.
...
... ....
.
.........
..



++
+++
+
  +++
±±
+

±±±
+
±

±±
××
 ++ ±±
×
 + ±
××

±±
×
+

×
±
×
  ++±
××
±


0

5

10

15

1.00

800
600
400
200
0

20





.........
.....
..............
.....
.....
.
.
.
.
.
......
........
......
......
.....
.
.
.
.
.....
......
......
.....
....
.
.
.
.....
......
....
......
....
......
....
...........
............
....
.
.
.
.
.
..
.............
....
...
.......
......
...
........
..... ........
...
.........
..... ....
.
...
....
.
.
.
.
.
.
.
.
.
.
.
.
....... ........................
......
.....
.
.............. ...........................
....
....
.....
.
......
.............................. .....................................
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...
...... ........... ....................
.
.
.
.
.
.
.
.
.
.
.
.
......
....... ..... ......... .........
................. ..............
................................................................................











+
+++
++
±

++ ±±±
+

±
×
+
±
×
+
+ ±±± × ×

+
±±±

×××××
++
±±±
+
 +
×××
×
±
××
±
+
±××
++
±±±
××+
××
0
5
10
15
20




0.68
0.52
0.52
0.68
1.00

(a) C45-cf vs. naive Bayes

0.00
0.05
0.10
0.15
0.20
0.25
0.30


  ++±±+   +
±
+

±
++
 +
±±±
  ++±± ×××××

+±
 ++
±±
××
 +±
××
 +± ××
± ×
 + ×
+± ×
 ± ×

+ ×
×
0
5
10
15
20
......................
...............
..................
...........
...........
..........................
........
............................
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
.........
............................
........
.......................
.
.
.
.
.
.
.
.
.
.
.... ....
...
..............
.......
...... .....
.....
..............
..... .....
.....
................
..
.
....
.
.
.
.
.
.
.
.
.
. .
..
..... ........
.....
...........
....
..... .....
.....
.....
..... .....
......
...
.... ...
......
.
.
...
... .....
.
.
.
.
.....
... ....
...
....
...
.......
.....
.....
...
......
....
.....
..
.
.
.
.
.
....
.......
...
......
...
... ..
...
...
... ...
...
.. ....
..
..
.
.
.
..
..
.......
..
...
......
...
...
.....
...
...
.....
..
.
....
...
..
...
...
... .....
.
.
..

1000
800
600
400
200
0

1.00



.............
...............
.........
.......
.
.
.
.
.
.
.
......
...
.....
......................
................
......
..... .
..........
.....
......................
.
.
.
.......
...
.
.
.
.
.
.
.
.
.
.
.
.
...
.....
....
....
.....
.....
.....
..........
....
..........
.
.
.
.
.
.
.
.
.
.
.
.
......
...
.....
..
....
.....
..........
...
.....
........
...
...
.
......
.
.
.
..
......
.........
.....
........
...
.
.
.
.
.
.
.
.
.
.
.
.
.
...
..
..........
...
......
......
.......
...
............
...........
......
...
.........
..........
.
.
...
.
.
.
.
.
.
.
....
.....
...
........
.......
.......
...
.........
.....
.. .......
....
.... .......
.
.
.
.
.
.
.
.
.
.
... .......
...........
.. ............
...............................





+±
+
±±+
+
±
+
±
±

+
±+
+
±

+
±
 +
±
+
±
±
××
  ++
××
±±
 +
××
×
 +
××
±
××
±
 ++
×
×
±± ×
+
+
±××××
+
±
+
××
×±


0

5

10

15

0.68
0.52
0.52
0.68
1.00

20

(b) C45-cf vs. kNN

0.00
0.05
0.10
0.15
0.20
0.25
0.30






....... ........
............ ...
.................
................
.
.
.
.
.
.
.
.
.
.
.
.
.
....
..............
......
......
......
.
.
.
.
..
......
.......
...
......
...
..............
.
.
.
.
.....
......
..................... ..................
...
..... ............ .........
.
.
.
.
.
.
.
.
.
.
.
.
.
..
..
...
.....
....
...
.....
...............................
......
..
.....
.
.................
...
.
.
.
.
.
..............
...
... ..
...............
.
............
.
.
.....
.
.
.......... .....
.............
..... ...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.....
..........
......



0







5





+++
+++± ±++±±± ±
++±±
±±
++
+±±
×××
±
+
±
× ×××
10

15

1000

1.00

800

0.68

600
400
200
0

20



.....................
...........
.......
.......
.
.
.
.
.
.
.
.
.
...........
.......
.....
.....
...........
.
.
.
.
.
.
.
.
.
.......
.....
....
.....
.....
.
.
.
.
.
.............
....
....
.....
........
.
.
.
.
.....

















..................
........+................+..................++..................
........++..............................+................±+................+........................±++.....................±.................+............±±±................±........±±±±
×××++...........................................+........................××.......±........±.......................+................+................±......××..........++
×
×××
×
+
................±±
×
±
×
×
+
±
±±
××
×.. ±
×××
0

5

10

15

0.52
0.52
0.68
1.00

20

(c) Naive Bayes vs. kNN

Figure 3: Power of statistical tests for comparison of two classifiers. Left: p values as a function of bias (k). Right: number of times the hypothesis was rejected (left axis) and the
Bouckaert’s R (right axis).
21

D EM ŠAR+...........................

1.0
0.9
0.8

T-test±...........................

T-test (rel)...........................


+
∓

1.0

×

0.9

.............
..............................................................................................
......................................................... .......... ...........

..........................................................................................................................................
.
...................
....... ...........
..... .......
..............
.
.
.
.
.
.
.
.
.
.
.
.
.
....
................

......................
......
.. .....
... .... ........
... ...............
.
.
...
..............
......
........
..................
.
.
.
.
.
.
.
.....
.
..........................................

∓
+

0.7

0.7

0.6

0.6

0.5

0.5
0

5

10

15

20

...........................

Sign test+......................................................................................
±
×..
... ..
.........................

...
...........
.....
... .....
.....
... ...
..........
... ...
...
.
.
.
.
...
.
.....
... ......
....
.....
.
.
.... .....
.....
...
.
.
.
.
....
....
.....
...
.
.
.....
.
.
...
.....
...
.....
.
...
.
...
.....
.........
...
.....
...
...
..... ........
...
...
...
.... ...
...
...
..........
...
...
......
...
.....
.
...
...
...
....
.....
...
......
....
.....
...
.
......
.
.
.
.
.
.... ......
.....
...
......
.
.....
...
... .......
...
.
.
.
... ......
.....
...
.....
.
...
.
.
.
....
...
.....
.....
...
...
.
... .......... ..........
...
...
.
.
.
.......... ...
...
...
.
.
...
.....
...
.....
........
...............
...
.
.....
...
...
..... ....
.
.
...
.......
.
...
.
.
. ......
...
.
.
.
.
.....
...
...
............
................
.....
.....
......
......
............
.....
........
...................



0.8

×

×

Wilcoxon


×
±
+

0

5

10

15

20

(a) C45-cf vs. naive Bayes

1.0
0.9
0.8

....
....
.........................................................+. ..................................................................................................................................∓.
.....................
....... ........
.
........................................... ............................................................................................................................... .. ×1.0..
......
.....
..........
.....
......... .
............ .............................
................... .....
.
.
.
.
. ...
.
........
...
....... .........
.....
..............
.....
.....
.
.
.
.
..
......
.......
......
.............

∓
+
×

0.9

×.............
.
÷+.................. .............

0.8



0.7

0.7

0.6

0.6

0.5

0.5
0

5

10

15

20

.....
......
.....
.....
.....
......
......
.....
...
...
...
.....
... .....
...
....
...
...
...
...
.
...
...
.
.
.
...
......
.
...
...
...................
......
...
...
....
......
...
....
...
......
...
...
....
.
......
.
.
...
.
....
......
..
....
...
.....
......
..
...
.....
...
......
...
...
...
......
.
...
.
.
.
.
.
.
...
.......
.
...
.....
...
...........
...
....
......
..... .....
...
..........
...
.......
..........
...
...
......
.
.
.
............
...
.
.
...
.................................
... ....
...
.
.
.
.
.
...
...
.
...
.....
.........
.....
...
...
..... .............
...
........
...
................
..........
...
....
.......... ........
.................
....
.
.
.
.
...... ...........
....
..............
....
.
.............
........ .........
.................... .................... ...........................
...........
...
.



+
÷

0

5

10

15

×
20

(b) C45-cf vs. kNN

1.0
0.9
0.8

1.0


+
∓
×

...................................................................
............................................
..............................
.............................
........
...................
....... .....
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. .
.............
................
...... .........................
...........
...........
................................
....................................................................................................
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
......................

.................................................
∓
+
×

0.8
0.7

0.6

0.6

0.5

0.5
5

10

15

..
......................... ................
........ .... .... ............................................ ...........
.....
...
.................... ...........................................................................
.....
.....
.
....
.......
....... ....... ....................
........... ......
.....
..... ........
............

×
÷
+

0.9

0.7

0

........................ ..........
×÷+......................................................................................................................................................

20

........

...
...
...
...
...
...
...
...
...
...
.....
.....
...
...
...
...........
...
...
.....................
.....
................
......
........
.......................................................



0

5

10

15

20

(c) Naive Bayes vs. kNN

Figure 4: Replicability of tests for comparison of two classifiers: variance-based R(p) (left) and
Bouckaert’s R(e) (right).
22

S TATISTICAL C OMPARISONS OF C LASSIFIERS OVER M ULTIPLE DATA S ETS

c45
c45
c45-m
c45-cftree
bayes
disc-bayes
knn.16/.96.05/.99.04/.98.15/.96.41/.92.16/.96c45-m
154/.74.10/.98.02/1.00.12/.97.20/.95.10/.98

c45-cf709/.59
307/.57

tree818/.70909/.83758/.63.05/.98.11/.97.28/.92.14/.97.05/.99.18/.94.06/.99

bayes
178/.71300/.58
335/.55
679/.56.20/.97.35/.94

disc-bayes
0/1.000/1.000/1.00162/.73
0/1.00knn
151/.74
376/.53
167/.72592/.52
2/1.00981/.96.01/1.00(a) Paired t-test

c45
c45
c45-m
c45-cftree
bayes
disc-bayes
knn.17/.96.06/.99.04/.99.16/.95.36/.94.14/.96c45-m
75/.86.11/.98.03/1.00.12/.97.20/.96.09/.98

c45-cf592/.52
238/.64

tree809/.69
848/.74
729/.60.06/.98.11/.97.27/.94.13/.97.05/.99.19/.95.06/.99bayes
181/.70314/.57
361/.54662/.55.24/.98.35/.95

disc-bayes
0/1.000/1.000/1.0079/.850/1.00knn
184/.70438/.51
216/.66
584/.51
1/1.00970/.94.01/1.00(b) Paired t-test on relative differences

c45
c45
c45-m
c45-cftree
bayes
disc-bayes
knn.08/.98.03/1.00.02/1.00.06/.99.22/.96.07/.98c45-m
521/.50

c45-cf884/.79
774/.65.04/.99.01/1.00.05/.99.11/.98.04/.99

tree
897/.82
983/.97854/.75.03/1.00.04/.99.16/.97.05/.99bayes
662/.55710/.59804/.68915/.84.02/1.00.08/.98.02/1.00.18/.97.22/.96

disc-bayes
81/.85351/.54
172/.71521/.50
94/.83knn
618/.53
750/.62
720/.60
920/.85
102/.82
999/1.00.00/1.00(c) Wilcoxon signed-ranks test

c45
c45
c45-m
c45-cftree
bayes
disc-bayes
knn.21/.90.10/.98.05/.99.19/.89.29/.89.25/.85c45-m
157/.74.16/.93.02/1.00.13/.94.18/.93.14/.93

c45-cf323/.56
205/.67tree
653/.55
863/.76513/.50.09/.97.08/.97.25/.89.15/.93.08/.97.18/.93.07/.97

bayes
171/.72
299/.58
423/.51
460/.50.52/.78.45/.86

disc-bayes
48/.91
156/.74
95/.83210/.67
0/1.00knn
110/.80
256/.62229/.65
486/.50
1/1.00850/.74.01/1.00(d) Sign test

Table 7: Tests for comparisons of two classifiers: average p-values and R(p) (below diagonal), andthe number of null-hypothesis rejections and R(e) (above diagonal).
23

D EM ŠAR+......................................................

0.00



ANOVA

......................................................

1.0

1000

0.9

800

0.8

600

0.7

400

0.25

0.6

200

0.30

0.5

0

0.05
0.10
0.15
0.20

     
++++++++   +++    ++++

+
++
+
+++
+
..........................................
.................................................. ..
........................................ .........................
..........................................................................................................
.
.
.
.
.
.
.
.
.
.
.......... ........... ..........................................
........... .........
...... .......
...................................
....... ........
...
....... .......
.................
...... ........
...... ..........
.
.
.
.
.
..... .....
..... .....
..... .....
..... .....
..... .......
.
.
.
.............. ........
.
.....
...
............

0

5

10

15

20

(a) Average p values (left axis) and R(p) (no symbols
on lines, right axis)

Friedman test
+

++
+

+
+
+

++
+

+
+
+

+


+

+
+

 +
+
++
....... ..............
.................................. .. ..........
............................................. ..................................................................
..............
................ ............
.
.................
.
.
.
.
.
.
.
..
.... ...
.........
...............................
..........
.....
.
.......
... ..............
.......
.. .....
.
.
.
.
.
.
.
.
... .
.. ..
... ...
.. ...
... ...
... ..
...... ..
.......
....... .....
...........
.....
.
.
...
...
....
......
.....
......
.....
.....
.....
.
.......
.....
......
.....
.
......
.. ..
.... .
.... ...
... ...
.
... ...
.. .
... ..
........ ......
......
...
...................


+
0

5

10

15

1.0
0.9
0.8
0.7
0.6
0.5

20

(b) Number of experiments in which the nullhypothesis was rejected (left axis) and the corresponding R(e) (no symbols on lines, right axis)

Figure 5: Comparison of ANOVA and Friedman test

differences between the algorithms (k at around 10, in our experimental setup), ANOVA catches up
and the two tests give similar results.
Replicability of the Friedman test is higher than that of ANOVA when measured by R(p) and,due to the similar power of the tests, comparable when measured by R(e). Altogether, replicability seems somewhat smaller than the replicability of the tests for comparisons of two classifiers.
Therefore, as common sense would suggest, when comparing multiple classifiers, it is even more
important to conduct the tests on as many data sets as possible.
Figure 6 shows the comparison between the parametric Tukey and the non-parametric Nemenyi
test. We counted the number of times they rejected the equivalence of C4.5-cf and naive Bayesianclassifier and the equivalence of C4.5-cf and kNN (the comparison between the naive Bayesian classifier and kNN, which was included in previous tests, was less interesting since the null hypothesis
was very seldom rejected). The two graphs on the left represent experiments in which the selection was based on the differences between the two algorithms compared on the graph, while for theright two graphs we used differences between the C4.5-cf and the average of the other six classifiers
tested. In all cases, we have compared all seven algorithms, but presented only the number of rejections for the pair on the graph. The non-parametric test again more often rejects the null-hypothesisthan the parametric one.
We do not show the p values and the corresponding replicabilities since they cannot always becomputed or compared in all procedures due to different orders of testing.
Figure 7 compares post hoc tests for comparisons with a control classifier, using the same two
ways of selecting data sets as in Figure 6. When the differences are large, the power of all tests iscomparable, while when they are smaller the number of rejections for the parametric test seems tolag behind (we have observed this same pattern on other combinations of algorithms). The orderof the non-parametric tests is as expected from the theory, although it is interesting to note that theHolm and Hochberg tests give practically equal results.
24

S TATISTICAL C OMPARISONS OF C LASSIFIERS OVER M ULTIPLE DATA S ETS+...........................

Tukey

1000
800
600
400
200
0



.......
..........
......
.............
.....
.
.
.
.
.
.
.
....
.....
....
......
.......
....
.
......
.
.
........
...
......
.....
........
....
........
.
.
.
.
.
.
.
.
.
.
...
.....
...
.....
...
......
...
......
....
.....
.
.
.
.
.
.
.
.
.
........
...
...
...
...
..
....
...
......
.
.
.
.
.
.
.
.
.....
...
.....
...
.....
...
........
... .........
.
.
.
.
.
..... ........
..........................









+++
+
+
++

++
++

+

+
 +++

+++
+
+
0
5
10
15
20




........... Nemenyi

1.00

1000

1.00

0.68

800

0.68

0.52

600

0.52

0.52

400

0.68

200

1.00

0

 
     ....... .....
............................. .......... .......
........
.................
.............
.
.
.
.
.
.
.
.
.
.
.
.......
.....
.....
....
.....
.
...................................................
.
.
.
..
.......................................
..... ............................
.
.....
...............................





 +++++++++++++++++
++
+
+
0
5
10
15
20

0.52
0.68
1.00

(a) C45-cf vs. naive Bayes

1000

1.00

1000

1.00

800

0.68

800

0.68

0.52

600

0.52

0.52

400

0.52

0.68

200

600
400
200
0





.
........................
......
.....
.....
.
.
.
.
.
.
.
.
.
.
.
.
.
.
......
......
.....
.....
.......
.
.
.
.
.
.
.
.
.
.
.....
.....
.....
.........................
......
.....................
......
.
.
..........
.
.
...
.........................
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
......
......................................................




 




++++++
 +++++++++

++++
+
+
0
5
10
15
20

1.00

0

0.68
       
+
+
+
+

+
+
++++++++++++
+
++
0
5
10
15
20
....
.......................................................... ............
.......................................
...............................................................................................................................................................

1.00(b) C45-cf vs. kNN

Figure 6: Power of statistical tests for comparison of multiple classifiers. Bias is defined by thedifference in performance of the two classifiers on the graph (left) or between the C4.5-cf
and all other classifiers (right). The left scale on each graph gives the number of times
the hypothesis was rejected and the right scale gives the corresponding R(e).

These experiments again seem to favour the non-parametric tests over the parametric ones although not always as convincingly as in the case of comparisons of two classifiers. Due to thetheoretical and practical advantages of the Friedman test (ease of computation and interpretation,
the ability to present the overall performance of classifiers in form of ranks instead of the dubious
averages), the Friedman test should be preferred over ANOVA. The corresponding non-parametricpost-hoc tests give similar results, so it is upon the researcher to decide whether the slightly more
powerful Hommel test is worth the complexity of its calculation as compared to the much simpler
Holm test.
25

D EM ŠAR+...........................

1000
800
600
400
200
0

Dunnett...........................

Bonferroni•• ?∗•+
?∗• • ?∗• ?∗•+
∗
?
+


•+
∗∗
+
•+
+
+
??
•+
∗
?
•
•++
∗ ?∗ 
?∗ ? +•∗?
+• ?∗ 
•+
?∗ 
•+
∗
?
+
• ?∗ +• ?∗ 
?∗
•+
•+
?∗ 
•
∗
?

+
∗
?

+
0
5
10
15
20
.....
........ ..
............................
......
.
......................................................
.
.
.
....
........ .......
........ ...........................
..... ..................
...... ........ .....
...... ...........................
.
.
.
.
.... ..
..
... ..........................
........ ....... ......
........ ..... ......
.......................
.
.
.... .. ..
..... ......
........ ......
.... .. ......
.. ...................
.
.
.. ..... ..
................ ...
....... ..... .....
...... .. ....
.....................
.
.
... .. ..
...........
............
..............
...................
.
.
.
.
................
.....................
.........

?

...........................

∗

Holm

...........................

Hochberg•...........................

Hommel

1.0

1000

1.0

0.68

800

0.68

0.52

600

0.52

400

0.68

200

1.00

0

•
•
• • • • • • • ∗? ∗••∗? ∗? ∗? ∗∗? ?  ?
• •• ∗? ∗? ∗? 
 +
+
∗∗

??
+

+
• ∗• ∗? ∗?+
+

+++
++
?   +
• ∗?+
 ++
∗?+
•+
• ∗? 
∗?+
•+
∗
?
•

∗?+
+
0
5
10
15
20
...
.... ......
....
......... ............................ .
.. ........
....... .........
.
...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.. .....
..... ..
..... .
....... ......................... .....
......
.................. ........... .
.. ...
......
............ .............................................
.
.....
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
............... ......
..
......
..... ......... .....
......... ....
... ........
.......... ....................
... ...... .................. ........
.. ...... ..................
........................
.
.
... .. ..
..... ..........
..... ..............
...............
..............................
.
.
.
.
.... .........
................

0.52
0.52
0.68
1.00

(a) C45-cf vs. naive Bayes

1000
800
600
400
200
0

?∗
•• ?∗• • ••• ?∗• ??
∗ ∗  ?∗ ?∗ 
•
•

?
∗

• ?∗ ?∗• ?∗• ?∗ • • ?∗• ?∗ ?∗
• ?∗
+ +
++ ++
• ?∗ 
+
++
++
• ?∗
+
+
• ?∗
++
?∗
•
+
+
?∗
++++
..
.........
....................... ..
............... ......................................
....... ............. ...
...... ...............................
.
.
.
.
.
.
.
.
.
.
..
...... .............
..... ................
..... ...........
..... .......
... .....................
.
.
.. ......
..... ......
..... .......
.. ......
.. ................
.
.
.. . ....
... ......
... ......
.........
...
... ......
.... ..... ...
.. ........
.
............ ..........
.....
... .......
.....
.
.
.. ........
.
.
.
.
.
.
.
.....
... ........
.......
... ......
......
.. ....
.......
.......
... ..........
.
.
.
.
.
.
.
....
... .......
.....
.. ......
.........
... ......
.....
...............
.....
.
.
.
.
.
.
.
..
....
.......
....................

0

5

10

15

1.0

1000

1.0

0.68

800

0.68

0.52

600

0.52

400

0.68

200

1.00

0

20

•• •
••••
•••
•
•
∗ ∗? ∗????
∗? ∗? ∗∗• • • ∗? ∗? ∗∗
??




∗? ∗?   • • ∗? ∗?• ∗?
• ∗? ∗? • ∗? ∗•∗? ?
+++++++++++++++++++++
0
5
10
15
20
.................
....................
.........
..........................
......
.
..
.
.
.
.
.
.
.
.
.
.
.
............ ..............
.........
.............
......
............................... ......................................
.....
.....
......
.
....
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..... ...........................
.....
.
.........
... ...... .....................
.
...
... ...... ......
.... .....................
.
.
.
. ..
... .........
... ...........
... ..........
..................
.
.........
..........
..
..
.............................................................................
.............................
.................................

0.52
0.52
0.68
1.00

(b) C45-cf vs. kNN

Figure 7: Power of statistical tests for comparison of multiple classifiers with a control. Bias isdefined by the difference in performance of the two classifiers on the graph (left) or between the C4.5-cf and the average of all other classifiers (right). The left scale on eachgraph gives the number of times the hypothesis was rejected and the right scale gives thecorresponding Bouckaert’s R.

5. Conclusion
Our analysis of the papers from the past International Conferences on Machine Learning has shownthat many authors feel that the algorithms they propose should be compared over a set of problems
and that the results can be used for drawing general conclusions. There is however no golden standard for making such comparisons and the tests performed often have dubious statistical foundations
and lead to unwarranted and unverified conclusions.
While comparisons using a single data set are pestered by the biased variance estimations due
to dependencies between the samples of examples drawn from the data set, in comparisons overmultiple data set the variance comes from the differences between the data sets, which are usually
26

S TATISTICAL C OMPARISONS OF C LASSIFIERS OVER M ULTIPLE DATA S ETS

independent. Our setup is therefore free from the elevated Type 1 error that is common on the single
data set testing procedures. The problems with the multiple data set tests are quite different, evenin a sense complementary: the measurements from different data sets are usually incommensurate,
and the normality of their distributions and the homogeneity of variance is questionable at best.
We theoretically and empirically analyzed three families of statistical tests that can be used forcomparing two or more classifiers over multiple data sets: parametric tests (the paired t-test and
ANOVA), non-parametric tests (the Wilcoxon and the Friedman test) and the non-parametric test
that assumes no commensurability of the results (sign test). In the theoretical part, we specifically
discussed the possible violations of the tests’ assumptions by a typical machine learning data. Basedon the well known statistical properties of the tests and our knowledge of the machine learning data,
we concluded that the non-parametric tests should be preferred over the parametric ones.
We have observed the behaviour of the proposed statistics on several real-world classifiers anddata sets. We varied the differences between the classifiers by biasing the selection of data sets,
and measured the likelihood of rejection of the null-hypothesis and the replicability of the test. We
have indeed found that the non-parametric tests are more likely to reject the null-hypothesis, whichhints at the presence of outliers or violations of assumptions of the parametric tests and confirms
our theoretical misgivings about them. The empirical analysis also shows that replicability of thetests might be a problem, thus the actual experiments should be conducted on as many data sets as
possible.
In the empirical study we provided no analysis of Type 1/Type 2 error rates. The main reason forthis is that the correct result—rejection or non-rejection of the null-hypothesis—is not well definedand depends upon the kind of difference between the algorithms we intend to measure. Besides,
conducting the experiments in which we knew the true hypotheses would require artificial data sets
and classifiers with the prescribed probabilities and distributions of errors. For this we would need tomake some assumptions about the real-world distributions; these assumptions are, however, exactly
what we were testing in the first place.
Overall, the non-parametric tests, namely the Wilcoxon and Friedman test are suitable for our
problems. They are appropriate since they assume some, but limited commensurability. They
are safer than parametric tests since they do not assume normal distributions or homogeneity ofvariance. As such, they can be applied to classification accuracies, error ratios or any other measurefor evaluation of classifiers, including even model sizes and computation times. Empirical results
suggest that they are also stronger than the other tests studied. The latter is particularly true whencomparing a pair of classifiers.
We have proposed a visual representation of the post-hoc analysis when multiple classifiers arecompared. CD diagrams are “space-friendly” and thus suitable when the length of the paper is an
issue, yet they present the order of the algorithms, the magnitude of differences between them (interms of ranks) and the significance of the observed differences much more clearly than it can bedone in textual or in a pure numerical form.
There is an alternative opinion among statisticians that significance tests should not be performed at all since they are often misused, either due to misinterpretation or by putting too muchstress on their results (Cohen, 1994; Schmidt, 1996; Harlow and Mulaik, 1997). Our stance is thatstatistical tests provide certain reassurance about the validity and non-randomness of the publishedresults. For that to be true, they should be performed correctly and the resulting conclusions should
be drawn cautiously. On the other hand, statistical tests should not be the deciding factor for oragainst publishing the work. Other merits of the proposed algorithm that are beyond the grasp of27

D EM ŠAR

statistical testing should also be considered and possibly even favoured over pure improvements inpredictive power.

Acknowledgments
I wish to thank my colleagues from Artificial Intelligence Laboratory and Cognitive Modeling Laboratory at the Faculty of Computer and Information Science in Ljubljana, Slovenia, especially Blaž
Zupan and Aleks Jakulin for their invaluable remarks and suggestions.

References
E. Alpaydın. Combined 5 × 2 F test for comparing supervised classification learning algorithms.
Neural Computation, 11:1885–1892, 1999.
J. R. Beck and E. K. Schultz. The use of ROC curves in test performance evaluation. Arch Pathol
Lab Med, 110:13–20, 1986.
R. Bellazzi and B. Zupan. Intelligent data analysis in medicine and pharmacology: a position statement. In IDAMAP Workshop Notes at the 13th European Conference on Artificial Intelligence,
ECAI-98, Brighton, UK, 1998.
Y. Bengio and Y. Grandvalet. No unbiased estimator of the variance of k-fold cross-validation.
Journal of Machine Learning Research, 5:1089–1105, 2004.
C. L. Blake and C. J. Merz. UCI repository of machine learning databases, 1998.
http://www.ics.uci.edu/∼mlearn/MLRepository.html.

URL

R. R. Bouckaert. Choosing between two learning algorithms based on calibrated tests. In T. Fawcett
and N. Mishra, editors, Machine Learning, Proceedings of the Twentieth International Conference (ICML 2003), August 21-24, 2003, Washington, DC, USA. AAAI Press, 2003.
R. R. Bouckaert. Estimating replicability of classifier learning experiments. In C Brodley, editor, Machine Learning, Proceedings of the Twenty-First International Conference (ICML 2004).
AAAI Press, 2004.
R. R. Bouckaert and E. Frank. Evaluating the replicability of significance tests for comparing
learning algorithms. In D. Honghua, R. Srikant, and C. Zhang, editors, Advances in Knowledge
Discovery and Data Mining, 8th Pacific-Asia Conference, PAKDD 2004, Sydney, Australia, May
26-28, 2004, Proceedings. Springer, 2004.
P. B. Brazdil and C. Soares. A comparison of ranking methods for classification algorithm selection.
In Proceedings of 11th European Conference on Machine Learning. Springer Verlag, 2000.
W. Cleveland. Robust locally weighted regression and smoothing scatterplots. Journal of the American Statistical Association, 74:329–336, 1979.
J. Cohen. The earth is round (p < .05). American Psychologist, 49:997 1003, 1994.
28

S TATISTICAL C OMPARISONS OF C LASSIFIERS OVER M ULTIPLE DATA S ETS

J. Demšar and B. Zupan. Orange: From Experimental Machine Learning to Interactive Data Mining, A White Paper. Faculty of Computer and Information Science, Ljubljana, Slovenia, 2004.
T. G. Dietterich. Approximate statistical tests for comparing supervised classification learning algorithms. Neural Computation, 10:1895–1924, 1998.
O. J. Dunn. Multiple comparisons among means. Journal of the American Statistical Association,
56:52–64, 1961.
C. W. Dunnett. A multiple comparison procedure for comparing several treatments with a control.
Journal of American Statistical Association, 50:1096–1121, 1980.
U. M. Fayyad and K. B. Irani. Multi-interval discretization of continuous valued attributes forclassification learning. In Proceedings of the 13th International Joint Conference on Artificial
Intelligence, pages 1022–1029, Chambery, France, 1993. Morgan-Kaufmann.
R. A. Fisher. Statistical methods and scientific inference (2nd edition). Hafner Publishing Co., New
York, 1959.
M. Friedman. The use of ranks to avoid the assumption of normality implicit in the analysis ofvariance. Journal of the American Statistical Association, 32:675–701, 1937.
M. Friedman. A comparison of alternative tests of significance for the problem of m rankings.
Annals of Mathematical Statistics, 11:86–92, 1940.
L. C. Hamilton. Modern Data Analysis: A First Course in Applied Statistics. Wadsworth, Belmont,
California, 1990.
L. L. Harlow and S. A. Mulaik, editors. What If There Were No Significance Tests? Lawrence
Erlbaum Associates, July 1997.
Y. Hochberg. A sharper Bonferroni procedure for multiple tests of significance. Biometrika, 75:
800–803, 1988.
B. Holland. On the application of three modified Bonferroni procedures to pairwise multiple comparisons in balanced repeated measures designs. Computational Statistics Quarterly, 6:219–231,
1991.
S. Holm. A simple sequentially rejective multiple test procedure. Scandinavian Journal of Statistics,
6:65–70, 1979.
G. Hommel. A stagewise rejective multiple test procedure based on a modified Bonferroni test.
Biometrika, 75:383–386, 1988.
D. A. Hull. Information Retrieval Using Statistical Classification. PhD thesis, Stanford University,
November 1994.
R. L. Iman and J. M. Davenport. Approximations of the critical region of the Friedman statistic.
Communications in Statistics, pages 571–595, 1980.
29

D EM ŠAR

P. Langley. Crafting papers on machine learning. In Proc. of Seventeenth International Conference
on Machine Learning (ICML-2000), 2000.
D. Mladenić and M. Grobelnik. Feature selection for unbalanced class distribution and naive bayes.
In I. Bratko and S. Džeroski, editors, Machine Learning, Proceedings of the Sixteenth International Conference (ICML 1999), June 27-30, 2002, Bled, Slovenia, pages 258–267. Morgan
Kaufmann, 1999.
C. Nadeau and Y. Bengio. Inference for the generalization error. Advances in Neural Information
Processing Systems, 12:239–281, 2000.
P. B. Nemenyi. Distribution-free multiple comparisons. PhD thesis, Princeton University, 1963.
J. Pizarro, E. Guerrero, and P. L. Galindo. Multiple comparison procedures applied to model selection. Neurocomputing, 48:155–173, 2002.
F. Provost, T. Fawcett, and R. Kohavi. The case against accuracy estimation for comparing induction algorithms. In J. Shavlik, editor, Proceedings of the Fifteenth International Conference on
Machine Learning (ICML-1998), pages 445–453, San Francisco, CA, 1998. Morgan Kaufmann
Publishers.
J. R. Quinlan. Bagging, boosting, and c4.5. In Proc. Thirteenth National Conference on Artificial
Intelligence, pages 725–730, Portland, OR, 1996. AAAI Press.
S. L. Salzberg. On comparing classifiers: Pitfalls to avoid and a recommended approach. Data
Mining and Knowledge Discovery, 1:317–328, 1997.
F. L. Schmidt. Statistical significance testing and cumulative knowledge in psychology. Psychological Methods, 1:115–129, 1996.
H. Schütze, D. A. Hull, and J. O. Pedersen. A comparison of classifiers and document representations for the routing problem. In E. A. Fox, P. Ingwersen, and R. Fidel, editors, SIGIR’95,
Proceedings of the 18th Annual International ACM SIGIR Conference on Research and Development in Information Retrieval, pages 229–237. ACM Press, 1995.
J. P. Shaffer. Multiple hypothesis testing. Annual Review of Psychology, 46:561–584, 1995.
D. J. Sheskin. Handbook of parametric and nonparametric statistical procedures. Chapman &Hall/CRC, 2000.
J. W. Tukey. Comparing individual means in the analysis of variance. Biometrics, 5:99–114, 1949.
E. G. Vázquez, A. Y. Escolano, and J. P. Junquera P. G. Riaño. Repeated measures multiple comparison procedures applied to model selection in neural networks. In Proc. of the 6th Intl. Conf.
On Artificial and Natural Neural Networks (IWANN 2001), pages 88–95, 2001.
G. I. Webb. Multiboosting: A technique for combining boosting and wagging. Machine Learning,
40:159–197, 2000.
F. Wilcoxon. Individual comparisons by ranking methods. Biometrics, 1:80–83, 1945.
J. H. Zar. Biostatistical Analysis (4th Edition). Prentice Hall, Englewood Clifs, New Jersey, 1998.
30