Elamur Research

Time for a Change: a Tutorial for Comparing Multiple Classifiers Through Bayesian Analysis

Paper · 2017 · Alessio Benavoli, Giorgio Corani, Janez Demšar et al.

Summary

An accuracy gain can be clear enough to measure and still too small to matter. A comparison can also be inconclusive because the experiment leaves too much uncertainty to tell the classifiers apart. Benavoli and colleagues argue that conventional significance testing makes these situations hard to distinguish. A p-value tells us how unusual a test result would be under a specified null hypothesis, such as exactly equal accuracy. The authors want to know how strongly the observed results support each outcome a researcher might act on. They make the case for changing how empirical comparisons are reported in machine learning.

The tutorial follows a comparison of naive Bayes, abbreviated nbc, and the averaged one-dependence estimator, abbreviated aode. The authors used WEKA to evaluate the classifiers on 54 UCI datasets, with 10 runs of 10-fold cross-validation on each dataset. Because the classifiers saw the same training and test splits, the authors could compare their accuracies within each split. Because training sets overlap across splits, the resulting differences are correlated. The frequentist correlated t-test accounts for this dependence and finds a statistically significant difference on 19 of the 54 datasets. That count leaves open how large the significant differences are and how many of the other comparisons support a practical tie.

The authors present three Bayesian procedures. A correlated t-test estimates the accuracy difference on a single dataset. A signed-rank procedure compares classifiers across datasets using one average difference from each. A hierarchical correlated t-test estimates differences across datasets while retaining information about the precision of each dataset’s cross-validation results. All three can use a region of practical equivalence, or rope. The authors use the interval [−0.01, 0.01] for accuracy differences measured as fractions. Probability inside the interval supports a practical tie, while probability on either side supports a meaningful advantage in the corresponding direction. Evidence spread across the regions can justify leaving the comparison unresolved.

The distinction matters in the worked examples. On hepatitis, the frequentist test crosses the significance threshold when the authors use the full set of fold results, while the Bayesian analysis reports a practical-equivalence probability of 1. The broader experiment gives the same distinction more room to show up. Across the dataset-level comparisons of the classifier pairs, 74 of the 341 cases where the frequentist test fails to reject exact equality support practical equivalence under the authors’ Bayesian decision rule. The tutorial places its argument alongside the American Statistical Association’s statement on p-values and the decision by Basic and Applied Social Psychology to ban significance testing. It also makes the procedures available in R and Python and supplies notebooks that reproduce the analyses.

Deep dive: Time for a Change: a Tutorial for Comparing Multiple Classifiers Through Bayesian Analysis

Benavoli and colleagues show how Bayesian tests compare classifiers by estimating the chance of a meaningful accuracy gain or a practical tie. · about 36 minutes to read

The problem and its context

From measuring accuracy to comparing methods

The authors describe a change in what counted as a contribution to the field. An early study could introduce a way to induce a classification tree and be interesting because it opened a new line of work. Once researchers had several ways to build similar classifiers, questions became more comparative. Different criteria for selecting attributes, for instance, could produce different results on real datasets. Deciding which criterion worked better required an empirical comparison, and the strength of the resulting claim depended on how the experiment was analysed.

The paper credits work by Salzberg, Dietterich and Demšar with establishing the expectation of statistical validation in classifier comparisons. An accuracy score is an estimate produced by a particular evaluation. Its value depends on the data used to train the classifier and on the cases held out to assess it. When two scores differ, the observed difference contains information about the methods and variation induced by the evaluation. A statistical analysis gives researchers a way to reason from the scores to a claim about performance.

There are several plausible claims a researcher might make. One concerns a specific dataset and asks whether the accuracy gain on that task is worth caring about. Another concerns a collection of datasets and asks how consistently an advantage appears. A third concerns an unseen dataset of the kind represented by the collection. An analysis can also make a statement about an average across tasks. That average and the predicted result on one new task answer different questions. Variation between tasks can make the next result hard to predict even when the average is well estimated.

The authors use a shared experimental setup to expose these distinctions. The classifier pair stays fixed while the analysis moves from fold-level observations to the difference on one dataset and then to an comparison across datasets. At each level, the statistical procedure has to say what it treats as an observation and what quantity its conclusion concerns. This is especially important with repeated cross-validation. A researcher can obtain many accuracy measurements from one dataset, but the measurements depend on overlapping training examples and cannot supply the same information as an equal number of independent experiments.

What significance testing answers

Null hypothesis significance testing, abbreviated NHST, starts with a hypothesis that specifies a reference case. For the usual two-sided comparison on one dataset, that case is a mean accuracy difference of zero. The procedure constructs a statistic from the measured differences and compares it with the statistic’s sampling distribution under the null. The p-value is the probability, under that reference case, of a statistic at least as extreme as the one observed. A significance threshold determines when that result is sufficiently unusual to reject the null.

The order of conditioning matters. A calculation that starts by assuming the null holds says how a statistic behaves under that assumption. A researcher who already has the results may want to assign probabilities to possible accuracy differences. That question starts with the observed data and asks how much support they give to competing claims about performance. Taking the complement of a p-value leaves the conditioning unchanged. The result still concerns the behaviour of the test statistic under the null.

The paper also questions whether exact equality is the right reference for an applied comparison. Two classifiers can differ by a trace amount that would never affect their selection. The authors regard such small non-zero effects as more plausible than perfect equality between different classifiers. A sufficiently precise experiment may give grounds to reject an exact zero even when the entire range of credible differences is too small to matter. A less precise experiment can leave a substantial effect possible while producing a p-value above the customary threshold. The test answers the reference question it was designed for in both situations.

The same distinction applies to a failure to reject. A large p-value can occur when a comparison is tightly concentrated around zero or when it is so uncertain that a fairly wide range of effects remains plausible. In the former situation a practical tie may be a well-supported finding. In the latter it may be premature to choose between the classifiers. The authors want an analysis in which those findings can be expressed directly. A useful answer identifies the direction and magnitude of the effect, the uncertainty around it, and the range of differences the analyst regards as immaterial.

The significance threshold creates a separate question about the meaning of the decision. The authors discuss the familiar values 0.05 and 0.01. In a correctly calibrated test, the nominal level describes the rate of rejection under the null and the specified sampling procedure. It does not specify a useful accuracy gain or give the probability that a particular rejection is mistaken. The tutorial also points out that the sampling distribution depends on the experiment the analyst planned to conduct. A plan to collect a fixed number of observations and a plan to use all available datasets need not generate the same reference distribution. The authors argue that this dependence is easy to overlook when researchers apply a customary test to the data they have gathered.

What changes across datasets

The paper describes a conventional way to extend the comparison to a collection. The analyst averages the paired cross-validation differences within each dataset and then applies a Wilcoxon signed-rank test to those averages. The test ranks effects by their absolute sizes and uses their signs to assess the evidence against a zero centre. A larger absolute difference can receive a higher rank, while its numerical distance from the next difference no longer enters directly. The resulting statistic is less sensitive to extreme magnitudes, a property the authors value when datasets vary widely.

This reduction also removes information. Each dataset is represented by one average, even when the fold-level results on some datasets are more variable than on others. Once those fold results are collapsed, the across-dataset test receives no direct estimate of how accurately each individual average measures the underlying difference. It also has no explicit term for dependence caused by overlapping training sets. The paper’s two Bayesian approaches to the across-dataset problem differ chiefly in whether they work with this reduction or retain the information that went into the averages.

A collection can also support many pairwise questions. Under NHST, a researcher concerned about making any false rejection across a family of tests may use a correction or an overall test. The authors note that a correction can depend on which comparisons the analyst includes in that family. A plan to compare one classifier with all its alternatives differs from a plan to compare every pair, even if the score for a particular pair is identical in both analyses. The paper treats this as another reason to ask directly about the size and credibility of the effects that matter.

The method, step by step

Start with a fair comparison on each fold

The data procedure is shared by the frequentist and Bayesian analyses. The authors choose accuracy, run the classifiers on a collection of datasets and match their evaluations split by split. In each run of cross-validation, a fold is held out for scoring and the training set consists of the remaining folds. Both classifiers receive the same training cases and are scored on the same held-out cases. Accuracy is the fraction of test cases classified correctly. Subtracting the two accuracies within the same split preserves the pairing and keeps the effect in the original units of the comparison.

The sign has to be fixed before interpreting any result. In the nbc–aode example, the authors’ dataset means are for nbc minus aode. A negative difference therefore favours aode. A positive difference favours nbc. This convention also governs which side of a posterior distribution corresponds to an advantage. The paper sometimes labels its across-dataset tables by classifier position instead, where “right” refers to the second classifier listed. Keeping the classifier names attached to the reported probability makes the comparison easier to follow.

From cross-validation scores to practical comparisons

The steps in order.

From cross-validation scores to practical comparisonsStep 1: Choose the accuracy metric and the dataset collection1. Choose the accuracy metric and the dataset collectionStep 2: Evaluate both classifiers on the same folds2. Evaluate both classifiers on the same foldsStep 3: Subtract the paired accuracy scores3. Subtract the paired accuracy scoresStep 4: Account for dependence among folds within datasets4. Account for dependence among folds within datasetsStep 5: Estimate the difference on one or several datasets5. Estimate the difference on one or several datasetsStep 6: Assign probability to each practical outcome6. Assign probability to each practical outcomeStep 7: Report the probabilities or apply a decision rule7. Report the probabilities or apply a decision rule

For one dataset, the basic summaries are the sample mean and sample variance of the paired differences.

x̄ = (∑ᵢ₌₁ⁿ xᵢ) / n

Here xᵢ is the paired accuracy difference on observation i. The index i runs from the first fold result through n, the total number of paired observations for the dataset. The summation sign adds those differences, and x̄ is their arithmetic mean.

σ̂² = (∑ᵢ₌₁ⁿ (xᵢ − x̄)²) / (n − 1)

Here σ̂² is the sample variance and σ̂ is its square root, the sample standard deviation. The squared deviation compares the observed xᵢ with the mean x̄. The sum runs over the n observations. The denominator is the number of observations minus one.

The mean and spread answer different questions. The mean describes the direction and size of the observed effect. The spread describes how much the measured difference moves as the training and test split changes. To infer the uncertainty of the mean, the analyst also needs to consider how much information the observations share. Overlapping training sets make a series of fold differences less informative than an independent series with the same mean and variance.

Establish the frequentist reference

The tutorial uses an approximation associated with Nadeau and Bengio to set a common correlation between observations. In its opening derivation, the relationship is written as follows.

ρ = nₜₑ / nₜₒₜ

Here ρ is the correlation between paired differences on distinct splits. The numerator nₜₑ is the size of the test set, and nₜₒₜ is the total size of the dataset available for training and testing. The paper uses 1/10 in its worked example with 10-fold cross-validation. The authors describe this as a heuristic. It originated in a setting with randomly drawn training and test sets, whereas the folds in a run of cross-validation are constructed as a partition.

The frequentist correlated t-test modifies the ordinary t-statistic by enlarging its uncertainty term when the correlation is positive.

t(x, μ) = (x̄ − μ) / √[σ̂²(1/n + ρ/(1 − ρ))]

Here x is the vector of paired differences, and μ is the hypothetical mean accuracy difference being tested. The numerator compares x̄, the observed mean, with μ. The denominator combines the sample variance σ̂² with a factor involving the observation count n and the correlation ρ. The square root returns the denominator to the units of the accuracy difference. When ρ is zero, the correlation term vanishes and the usual t-statistic is recovered.

For the two-sided comparison, the paper tests zero as the hypothetical mean and counts extreme values in both tails.

p = 2 · [1 − Tₙ₋₁(|t(x, 0)|)]

Here p is the two-sided p-value. The statistic t(x, 0) is calculated from x with the null mean set to zero, and the vertical bars take its absolute value. For a standard Student t-distribution with n − 1 degrees of freedom, the cumulative distribution function is denoted by Tₙ₋₁. The complement gives the upper tail beyond the observed absolute statistic. The factor 2 includes the matching lower tail.

For a directional test whose alternative is a positive difference, the tutorial uses the upper tail of the signed statistic.

p = 1 − Tₙ₋₁(t(x, 0))

Here p is the one-sided p-value, t(x, 0) is the signed statistic evaluated at the zero boundary, and Tₙ₋₁ is the same cumulative distribution function. The complement selects values at least as large as the observed statistic in the positive direction. The dataset-level results in the paper use the two-sided version.

Estimate the effect on one dataset

The Bayesian analysis treats the unknown accuracy difference as a quantity whose plausible values can be estimated from the data. A likelihood describes the joint behaviour of the observed fold differences under candidate parameters. A prior describes how the candidate values are weighted before those observations enter the analysis. Combining the two produces a posterior distribution. Its location describes the estimated effect, and its spread describes the uncertainty that remains under the chosen assumptions.

The authors use Bayesian estimation because it lets them put zero on the same continuum as small gains or losses. They also discuss the Bayesian alternative based on Bayes factors, where a specification allowing only a point null competes with one allowing a broader range. The examples in the tutorial all use estimation. The effects of interest are intervals of possible values, so a continuous posterior is enough to ask how credible practical equality is.

The observation equation for the Bayesian correlated t-test expresses each fold difference as the dataset’s underlying mean plus a residual.

x = 𝟙μ + v

Here x is the vector of n observed paired differences, 𝟙 is a vector of n ones, and μ is their common unknown mean. Multiplication by 𝟙 places μ in each coordinate. The residual vector v has a multivariate normal distribution with zero mean and covariance matrix Σ. The diagonal elements of Σ are σ², the common observation variance. Each off-diagonal element is σ²ρ, the covariance of two distinct observations. This structure uses one common correlation to approximate the dependence among all the cross-validation results on the dataset.

p(x | μ, Σ) = exp[−(x − 𝟙μ)ᵀΣ⁻¹(x − 𝟙μ)/2] / [(2π)ⁿ⁄²√|Σ|]

Here p(x | μ, Σ) is the likelihood density of the observed vector x conditional on μ and Σ. The operator exp is the exponential function. The vector x − 𝟙μ contains the residuals around the candidate mean, the superscript ᵀ transposes that vector, and Σ⁻¹ is the inverse covariance matrix. The expression in the exponent weights the residuals by their joint covariance. The determinant |Σ| and the factor involving π, the usual mathematical constant, normalize the density in n dimensions.

The authors explain why they fix the cross-validation correlation. In this likelihood, maximizing over ρ returns zero regardless of the observations, so fitting it directly does not recover the dependence the analysis is meant to represent. The paper uses the cross-validation heuristic to supply the correlation and estimates the effect and the noise level conditional on that choice.

The prior is specified jointly for the mean and the precision, with precision defined as the reciprocal of the observation variance. The paper uses the Normal-Gamma family, in which the mean has a normal distribution conditional on precision and precision has a gamma distribution.

p(μ, ν | μ₀, k₀, a, b) = N(μ; μ₀, k₀/ν) · G(ν; a, b)

Here ν is the precision, equal to the reciprocal of σ². The left-hand side is the joint prior density of μ and ν given the prior parameters μ₀, k₀, a and b. The function N is the normal density evaluated at μ, with prior centre μ₀ and conditional variance k₀/ν. The function G is the gamma density for ν, specified by a and b. The multiplication expresses the conditional prior for the mean together with the prior for precision. In the hierarchical procedure below, the paper reuses ν for degrees of freedom.

The authors choose a limiting specification known as a matching prior. They set μ₀ to 0, let k₀ tend to infinity, and use a = −1/2 and b = 0. This choice gives an analytic posterior for the mean. It also creates a controlled comparison with the frequentist calculation because the same Student distribution form and the same adjustment for dependence appear in both.

p(μ | x, μ₀, k₀, a, b) = St(μ; n − 1, x̄, σ̂²[1/n + ρ/(1 − ρ)])

Here p is the posterior density of the unknown difference μ after observing x under the stated prior. The function St is a Student density evaluated at μ. Its arguments after the semicolon are the degrees of freedom, the location x̄ and the squared scale. The squared scale depends on σ̂², the sample variance, n, the observation count, and ρ, the assumed correlation. The arithmetic in the scale is shared with the frequentist test. Its role here is to describe uncertainty about the effect given the observations.

Turn a continuous estimate into practical probabilities

A posterior distribution can answer a question about direction by assigning probability to all positive or all negative effects. The authors also ask how much of that probability lies on differences large enough to matter. They do this by placing a symmetric interval around zero. The boundaries represent the accuracy change beyond which they would treat a classifier as practically better. In the experiments the interval is [−0.01, 0.01]. On the fraction scale used for the statistical analysis, this is the paper’s tolerance of 1% in accuracy.

(pₗ, p꜀, pᵣ) = (∫₋∞⁻ʳ f(μ) dμ, ∫₋ᵣʳ f(μ) dμ, ∫ᵣ∞ f(μ) dμ)

Here f is the posterior density of the dataset’s mean difference μ, and r is the positive half-width of the rope. The integrals add probability across the left tail, the central interval and the right tail, respectively. The symbol dμ indicates integration with respect to the difference μ. The resulting probabilities pₗ, p꜀ and pᵣ refer to practical advantage for the classifier favoured by negative values, practical equivalence and practical advantage for the classifier favoured by positive values. For a continuous density the endpoints themselves carry no mass.

The paper also shows highest-density intervals. Such an interval contains a chosen share of the posterior and covers the values with the highest density for the Student distributions illustrated. A shorter interval indicates that a given amount of probability is concentrated within a comparatively narrow range of effects. Several intervals at different probability levels show both the concentrated part of the estimate and the range needed to cover more of its uncertainty. The rope and the highest-density intervals can be read together. One describes what matters for the comparison and the other describes what the data and assumptions make credible.

A decision rule is optional. In the examples, the authors declare an outcome when its posterior probability exceeds 0.95. If none clears the threshold, the comparison remains unresolved. They mention 0.90 and 0.80 as possible choices in other contexts and show how a loss function can make the choice of threshold interpretable. In their illustration, an incorrect declaration costs 20 and withholding a decision costs 1. A correct declaration carries zero loss.

expected losses = Lp

Here L is a loss matrix with a row for each action and a column for each possible state of the accuracy difference. The actions are a declaration favouring either classifier, a declaration of practical equivalence, or no decision. The states are the left, central and right regions of the rope. The column vector p contains their posterior probabilities pₗ, p꜀ and pᵣ. Matrix multiplication weights each possible cost by the probability of the state that incurs it. The action with the smallest expected loss is preferred. In the paper’s example a declaration is preferable to withholding a decision when its posterior probability is above 0.95.

Compare dataset averages with the signed-rank procedures

For the across-dataset analyses based on averages, the authors give every dataset one input value. They call the resulting values zᵢ. In the nbc–aode example, each zᵢ is the average paired accuracy difference for a dataset. The conventional signed-rank test treats the dataset averages as independent draws from a common symmetric distribution and tests a zero median. The method orders their absolute magnitudes and sums the ranks on one side. The paper gives an equivalent expression based on sums of pairs.

t = ∑₁≤ᵢ≤ⱼ≤q I₍zᵢ₊zⱼ ≥ 0₎

Here t is the signed-rank statistic as expressed through pairs. The indices i and j refer to dataset averages zᵢ and zⱼ, and q is the number of datasets. The summation includes pairs on and above the diagonal, so an average can be paired with itself. The indicator I equals 1 when the pair sum is non-negative and 0 otherwise. This way of writing the statistic makes the connection to the Bayesian version visible.

For the large-sample approximation, the paper standardizes t using its null mean and standard deviation, with an adjustment for ties in the absolute differences. It then computes the two-sided tail probability.

p = 2[1 − Φ(|w|)]

Here p is the two-sided p-value, w is the standardized signed-rank statistic under the null, and |w| is its absolute magnitude. For the standard normal distribution, Φ denotes its cumulative distribution function. The complement takes the upper tail, and the factor 2 accounts for both directions. As in the single-dataset test, the tail area concerns the statistic under the null.

The Bayesian approach associates a probability distribution with the observed dataset averages. It uses a Dirichlet process prior, which specifies uncertainty about a probability distribution rather than imposing a fixed shape such as a symmetric bell curve. The posterior representation used in the paper places probability mass at the observed averages and at one additional value supplied by the prior. The weights vary from draw to draw. A weight represents how much mass a possible distribution gives to that value.

P(dz) = ∑ⱼ₌₀^q wⱼ δ_zⱼ(dz)

Here P is a random probability measure for the dataset-level difference, and dz denotes its measure argument. The index j runs through the prior entry and all q observations. For j greater than zero, zⱼ is a measured dataset average. The prior entry z₀ is a pseudo-observation, a reference value introduced by the prior. The point mass δ_zⱼ puts all its own mass at zⱼ, and wⱼ is its share of the overall probability. The sum combines those weighted point masses into one draw of the distribution.

(w₀, w₁, …, w_q) ∼ Dir(s, 1, …, 1)

Here the w entries are the weights in the probability measure. The symbol ∼ means the weight vector is drawn from the specified distribution. Dir is the Dirichlet distribution, which yields non-negative weights that sum to one. Its first parameter s gives the strength of the pseudo-observation. Each observed dataset contributes a parameter of 1. The working prior in the paper uses s = 0.5 and z₀ = 0.

The Bayesian sign procedure uses the total weight of the point masses in each region directly.

θ_A = ∑ᵢ₌₀^q wᵢ I_A(zᵢ)

Here A is one of the three regions defined by the rope, θ_A is the probability assigned to that region in a draw, and I_A gives 1 if zᵢ is in A and 0 if it is outside. The index i includes the pseudo-observation and the q measured averages. Each wᵢ is the corresponding Dirichlet weight. The three region masses have a joint Dirichlet distribution whose parameters are the counts in each region plus the prior strength in the region containing the pseudo-observation. For this sign procedure, the counts determine how the observations affect the parameters.

The signed-rank version uses two draws from the same weighted distribution. It asks whether their average lands to the left of, inside, or to the right of the rope. Comparing their sum with the doubled boundaries gives the same assignment.

(θₗ, θₑ, θᵣ) = ∑ᵢ₌₀^q ∑ⱼ₌₀^q wᵢwⱼ (I₍₋∞,₋₂ᵣ₎(zᵢ + zⱼ), I₍₋₂ᵣ,₂ᵣ₎closed(zᵢ + zⱼ), I₍₂ᵣ,∞₎(zᵢ + zⱼ))

Here θₗ, θₑ and θᵣ are the probabilities for the negative, equivalent and positive regions for a particular draw of the weights. The indices i and j run over the q dataset means and the pseudo-observation. The product wᵢwⱼ is the probability of drawing that ordered pair. Each indicator tests the sum zᵢ + zⱼ against its indicated interval. The central indicator marked “closed” includes both endpoints, and the outer intervals exclude them. The factor 2 appears because the rope half-width r applies to the pair average while the indicators operate on the sum.

A single set of weights gives one such probability vector. The authors repeatedly draw the weights and recompute the vector to see how credible various balances among the outcomes are. This is Monte Carlo sampling, where repeated draws approximate a distribution and its probabilities. The procedure estimates the distribution from the observed values without requiring the symmetry assumed by the conventional signed-rank test. It still relies on the dataset-level observations as its units of evidence.

Retain fold-level uncertainty with the hierarchical test

The hierarchical correlated t-test keeps a separate unknown accuracy difference for every dataset while treating those differences as related. Each dataset supplies a vector of paired fold results. The vectors share a common statistical structure but can have different means and noise levels.

xᵢ ∼ MVN(𝟙μᵢ, Σᵢ)

Here xᵢ is the vector of fold differences for dataset i, and MVN is a multivariate normal distribution. The ones vector 𝟙 repeats the dataset’s unknown mean μᵢ across the vector’s coordinates. The covariance matrix Σᵢ has diagonal entries σᵢ² and off-diagonal entries ρσᵢ², where σᵢ is the dataset’s observation standard deviation and ρ represents correlation between folds. Thus a noisy dataset can contribute a different amount of information about its own effect than a dataset with tightly grouped fold results.

μ₁, …, μ_q ∼ St(μ₀, σ₀, ν)

Here μ₁ through μ_q are the underlying differences for the q datasets. They are drawn from a common Student distribution St with location μ₀, dispersion parameter σ₀ and degrees of freedom ν. The location represents the centre of accuracy differences across the task population. The dispersion describes variation across datasets, and the degrees of freedom control the heaviness of the tails. Heavy tails let a dataset have an unusually large effect while exerting less pressure to move the centre of the entire collection.

σ₁, …, σ_q ∼ Unif(0, σ̄)

Here σ₁ through σ_q are the individual within-dataset standard deviations, Unif is a uniform distribution, and σ̄ is their common upper prior bound. The paper sets that bound to 1,000 times the average within-dataset sample standard deviation. The authors choose a broad bound so the posterior has room to reflect differences in the variability of the fold results. Inference about the mean effects integrates over these uncertain standard deviations instead of treating their estimates as exact.

The paper uses additional priors for the common Student distribution. The location has a uniform prior on the allowed range of differences for scores bounded between zero and one.

μ₀ ∼ Unif(−1, 1)

Here μ₀ is the population location of the accuracy differences, and Unif assigns equal prior density from −1 to 1. The authors give accuracy, precision, recall and AUC as examples of measures for which bounds of this form are suitable. A measure on another scale can require another interval.

σ₀ ∼ Unif(0, σ̄₀)

Here σ₀ is the dispersion parameter of the distribution across datasets, and σ̄₀ is the upper bound of its uniform prior. The authors set σ̄₀ to 1,000 times the sample standard deviation of the observed dataset means. This is a separate bound from σ̄, which concerns variation among folds within a dataset.

ν ∼ Ga(α, β)

Here ν is the Student distribution’s degrees of freedom, Ga is the gamma distribution, and α and β are its parameters. The paper discusses earlier gamma specifications that assign different amounts of probability to heavier tails and to distributions closer to normal. It lets the gamma parameters vary under their own priors.

(α, β) ∼ Unif(0.5, 5) × Unif(0.05, 0.15)

Here α is drawn from the uniform interval with endpoints 0.5 and 5, and β from the uniform interval with endpoints 0.05 and 0.15. The multiplication sign denotes the product of the two prior distributions. These bounds specify the range of gamma distributions that enter the hierarchical prior for ν.

The estimates are linked because each dataset informs the common distribution and that distribution helps estimate each dataset’s effect. The result is partial pooling, also called shrinkage. A dataset average measured with substantial uncertainty can be pulled toward the shared centre. A precisely measured effect has more information of its own to resist that pull. The tutorial cites related work on when this joint estimation improves estimates of dataset effects, including cases where the fitted across-dataset distribution differs considerably from the one that generated the results.

The authors use Markov chain Monte Carlo in Stan to obtain draws from the joint posterior. For a prediction on an unseen dataset, they take a draw of μ₀, σ₀ and ν and use the corresponding Student distribution for the new effect. They calculate the probabilities of falling below, within and above the rope for that distribution, then repeat the calculation over posterior draws. This procedure retains both the estimated variation among datasets and uncertainty about its governing parameters. It also distinguishes predicting the effect on a new dataset from summarizing the posterior of the population centre.

Experiments and results

The paired benchmark and its frequentist baseline

The benchmark consists of 54 UCI datasets obtained through WEKA. The authors evaluate accuracy using 10 runs of 10-fold cross-validation, which gives 100 paired differences per dataset for each classifier pair. The original comparison is between nbc and aode. The broader comparison adds hidden naive Bayes, abbreviated hnb, and two decision tree variants, j48 and its grafted version, j48gr. This setup serves as a common basis for comparing the statistical procedures. The competing procedures analyse the same classification results.

On anneal, the example used to show the arithmetic of the correlated t-test, the mean of the paired accuracy differences is −0.0194 on the fraction scale. The sample standard deviation is 0.01583, and the analysis uses correlation 1/10. The resulting t-statistic for zero mean is −3.52. The paper reports a two-sided p-value of 0.00065, shown as 0.001 in the results table. The Bayesian calculation with the matching prior gives a Student posterior with 99 degrees of freedom, centred at −0.0194, with squared scale 0.000030. In this example, the two analyses start from the same measurements and dependence adjustment. The Bayesian output makes it possible to ask what fraction of the uncertainty lies beyond a practical boundary.

The frequentist correlated t-test reports statistically significant differences in 19 of the 54 nbc–aode comparisons at the paper’s 0.05 threshold. The Bayesian analysis examines the full shape of each posterior. The paper describes 12 datasets where the posterior is concentrated on a practical advantage for aode and 6 where it is concentrated inside the rope. It reports no corresponding case of clear concentration on a practical advantage for nbc. These descriptions of the plots give a sense of their shapes. The paper separately tabulates the outcomes of an explicit posterior-probability rule.

For the dataset called squash-unsorted in the worked posterior example, the sign alone favours aode with probability 0.835 and nbc with probability 0.165. With the rope on the same posterior, the probability of a practically meaningful advantage is 0.788 for aode and 0.126 for nbc. The probability of practical equivalence is 0.086. The sign question allows every non-zero advantage to count. The practical question moves the probability of sufficiently small advantages into the central interval. The largest of the resulting probabilities still favours aode, while the formal rule at 0.95 leaves the comparison open.

When the decision rules diverge

The two-sided frequentist test fails to reject exact equality for nbc and aode on 35 of the 54 datasets. Among those cases, the Bayesian rule finds practical equivalence on 6. There are 19 datasets where the frequentist test rejects equality. On those datasets the Bayesian rule gives a practical advantage to one classifier in 14 cases, declares a practical tie in 1 and leaves 4 unresolved. Counting declarations of practical equivalence as decisions, the Bayesian procedure makes 21 decisions for the pair. The frequentist procedure reports 19 rejections. The counts reflect the kinds of conclusions available to each rule.

The extension to the other classifiers yields 540 dataset-level pairwise comparisons. The frequentist correlated t-test fails to reject the null in 341 of them. The Bayesian rule declares practical equivalence in 74 of those 341 cases. The paper gives that share as 22%. It reports 267 unresolved cases in the same group. The split matters because all these comparisons have the same binary frequentist outcome, while their posterior distributions differ in how much mass they concentrate inside the rope.

Among the 199 comparisons that the frequentist test calls significant, the Bayesian rule declares a meaningful difference in 142. The paper reports this as 71% of the frequentist rejections. A further 51 cases, reported as 26%, remain unresolved. In 6 cases, reported as 3%, the Bayesian analysis supports practical equivalence. Thus practical ties occur both among comparisons that reject exact equality and among comparisons that fail to reject it. Across the full benchmark the paper reports 222 Bayesian decisions of either kind and 199 frequentist rejections.

The two tree variants show this pattern particularly clearly. The frequentist correlated t-test fails to reject equality on 50 datasets for j48 versus j48gr. Of these, 40 meet the Bayesian threshold for practical equivalence. The frequentist procedure rejects equality on 4 datasets for the same pair. Within that group, the Bayesian analysis reports 2 practical ties, 1 practical difference and 1 unresolved comparison. This pair contributes a substantial share of the equivalence findings in the wider experiment. The overall decision totals therefore describe this particular mix of classifier pairs as well as the behaviour of the statistical procedures.

Looking across datasets

For its frequentist analysis across the collection, the paper reduces each dataset to a mean accuracy difference and runs the Wilcoxon signed-rank test on those means. For nbc versus aode, the reported rank statistic is 162, the standardized value is −4.8 and the p-value is 10⁻⁶. The mean differences are frequently small even though the evidence against a zero centre is strong. For instance, the paper’s dataset-level mean differences on the accuracy scale from 0 to 100 include −0.212 on hepatitis and −0.202 on yeast, alongside −10.043 on pasture. Those values are means across paired folds within the named datasets, instead of the output of the across-dataset test.

The paper also reports a significant signed-rank difference for nbc versus hnb and for j48 versus j48gr. The tree comparison is informative because the numerical differences are small across the datasets even though the signed ranks give evidence against a zero centre. A direction repeated consistently across datasets can contribute to that outcome. Whether such a difference justifies preferring one tree method depends on the size of the effect and on the purpose of the comparison.

The Bayesian signed-rank analysis of nbc versus aode starts with the direction question, using r = 0. All the reported draws have the left-side probability above 0.5, where the negative side means an advantage for aode under nbc-minus-aode coding. The authors describe their certainty about that directional preference as roughly 1. This is a statement about how consistently the posterior draws favour a direction. It does not imply that the accuracy advantage appears on every dataset.

When the authors introduce the rope, they show the sampled probability vectors in a triangle. Each corner represents complete probability for one of the three outcomes. A point along an edge splits probability between the adjacent outcomes, and a point inside the triangle distributes it among all three. The nbc–aode cloud leans toward aode while extending towards equivalence. The result table assigns 0.897 to aode and 0.103 to practical equivalence. It assigns 0.000 to nbc. Those numbers summarize how the posterior draws fall into decision regions. They describe a different calculation from the area under the single-dataset posterior for squash-unsorted.

The same analysis assigns a probability of 0.999 to hnb’s practical advantage over nbc. For aode and hnb, the equivalence result is 0.956. For j48 versus j48gr it is 1.000, even though the frequentist signed-rank test reports a significant difference for the pair. This is the across-dataset counterpart of the hepatitis comparison. A consistent departure from exact equality and strong evidence that a difference falls inside the tolerance can arise from the same results.

What changes when fold variability is retained

The hierarchical test also produces probabilities for practical outcomes, now by predicting the mean accuracy difference on a new dataset under the fitted hierarchy. The numerical comparison below uses the authors’ tables for the aode–j48 pair. In both analyses the outcome being compared is practical equivalence across the 54-dataset benchmark.

Practical equivalence for aode and j48 across the 54 UCI datasets

The hierarchical test assigns more posterior support to equivalence when it retains the fold-level information.

Practical equivalence for aode and j48 across the 54 UCI datasetsBayesian signed-rank: 0.026Bayesian signed-rank0.026Bayesian hierarchical correlated t-test (this paper): 0.51Bayesian hierarchical correlated t-test(this paper)0.51
The numbers
System or settingposterior decision probability
Bayesian signed-rank0.026
Bayesian hierarchical correlated t-test (this paper)0.51

For aode versus j48, the signed-rank result assigns 0.911 to aode’s practical advantage, while the hierarchical result assigns 0.46. The analogous comparison with j48gr shifts in the same direction. The signed-rank analysis assigns 0.892 to aode and 0.035 to equivalence. The hierarchical analysis assigns 0.41 to aode and 0.56 to equivalence. The hierarchical result thus spreads support between an advantage for aode and practical equivalence for both tree comparisons. Neither hierarchical equivalence number approaches the single-dataset decision threshold used earlier in the tutorial.

Several other results align more closely. Both procedures favour hnb over nbc and both strongly support practical equivalence for the two tree variants. For nbc versus aode, the hierarchical results table assigns 0.72 to aode and 0.28 to equivalence. The surrounding discussion describes the hierarchical preference for aode as almost certain. The tabulated values support the direction of preference while leaving appreciable probability for equivalence, so they give the more precise account of that comparison.

The authors report that the hierarchical analysis of 5400 fold observations for a classifier pair took about three minutes on a standard computer. They report less than one second for a signed-rank comparison in their setup. These timings reflect the cost of the reported inference procedures: the hierarchical approach samples a joint posterior over dataset-specific and shared quantities, while the signed-rank calculation works from the dataset averages. The computation time refers to analysing the cross-validation outcomes. Training the classifiers to obtain those outcomes is an earlier operation.

What the ablations show

The paper has no classifier-component ablations. Its controlled analyses change how much evidence goes into a comparison, what counts as a meaningful difference, how the prior is specified, and which parts of the fold results are retained.

More fold results can change significance without changing practical scale

On hepatitis, the authors run the frequentist correlated t-test using 15 of the 100 paired fold observations and again using all 100. With the smaller subset the p-value is 0.077. With the full set it is 0.048. This moves the outcome across the 0.05 rejection threshold. The accuracy differences in the example remain small relative to the practical tolerance. For the full-data posterior the paper reports a practical-equivalence probability of 1.

The hepatitis analysis holds the classifier pair and dataset fixed. The contrast arises from analysing a subset and then the complete collection of scores. It shows that the amount of evidence needed to distinguish a small effect from zero can be different from the amount needed to establish that the effect is useful. In this case, the full comparison supports a small effect with enough precision for the practically relevant conclusion to be a tie.

The authors also put comparisons with similar p-values side by side. Audiology and breast-cancer yield two-sided correlated-test p-values of 0.622 and 0.598, respectively. The plotted results show more concentration near zero for audiology and a broader spread for breast-cancer. In the Bayesian displays, the strength of the evidence still falls short of making both of these straightforward decisions. Their value as examples is that the plots show how much uncertainty belongs to each case and which practical boundaries it crosses.

For ecoli and iris, the frequentist examples illustrate very small p-values alongside different spreads of the measured accuracy differences. The paper’s discussion of the fold-difference plots describes the broader spread on ecoli, while its discussion of the later posterior plots attributes greater posterior uncertainty to iris. These are different plotted quantities, and the tutorial gives no common numerical interval with which to verify that reversal. The comparison supports the narrower observation that similarly small p-values alone give little guidance about the magnitude or precision of the estimated effect.

A practical margin and a movable prior

In the nbc–aode signed-rank example, introducing the rope changes the question while leaving the dataset averages and baseline prior in place. The directional analysis overwhelmingly favours aode. Once small differences are allowed to count as equivalent, some draws support a practical tie. This comparison shows what the interval contributes. It changes which effects belong to an advantage and which belong to equivalence, so it can change a conclusion even when the underlying observations and posterior calculation are otherwise the same.

The authors then move the prior pseudo-observation to each extreme while holding the prior strength at 0.5. The default pseudo-observation is at zero, inside the rope. The positive and negative extremes probe how much that reference input can move the result if placed outside the observed range in either direction.

Prior-location sensitivity of the aode preference in the Bayesian signed-rank comparison across the 54 UCI datasets

Moving the pseudo-observation to either extreme shifts the strength of the preference while preserving its direction.

Prior-location sensitivity of the aode preference in the Bayesian signed-rank comparison across the 54 UCI datasetsPseudo-observation at positive infinity: 0.888Pseudo-observation at positive infinity0.888Centred pseudo-observation used in the main analysis (this paper): 0.897Centred pseudo-observation used in themain analysis (this paper)0.897Pseudo-observation at negative infinity: 0.904Pseudo-observation at negative infinity0.904
The numbers
System or settingposterior decision probability
Pseudo-observation at positive infinity0.888
Centred pseudo-observation used in the main analysis (this paper)0.897
Pseudo-observation at negative infinity0.904

Here the higher value denotes greater support for aode, and the star identifies the prior used in the main analysis. The preference for aode persists across the three placements. The degree of support moves more noticeably in some other comparisons. For aode against j48gr, the signed-rank probability favouring aode ranges from 0.872 at the negative extreme to 0.906 at the positive extreme. For practical equivalence between the two tree variants, all three settings report 1.000. The effect of changing the prior is therefore easiest to see in comparisons with appreciable uncertainty between the outcomes.

The hierarchy has its own sensitivity analysis. The authors vary constants in the priors for the Student distribution’s degrees of freedom and say the resulting inferences are essentially the same across the specifications they tried. The concern is that stronger prior support for heavy tails can change how the hierarchy treats unusual datasets. The reported stability addresses the tested perturbations of the upper-level priors. It complements the pseudo-observation check, which addresses a different source of prior sensitivity in the signed-rank procedure.

Dataset averages versus the fold-level likelihood

The comparison between the Bayesian signed-rank test and the hierarchy uses the same collection and practical tolerance. The signed-rank test takes the sample mean from each dataset. The hierarchy uses the fold-level observations, allowing each dataset to contribute an estimate of within-dataset variability and accounting for cross-validation correlation. The clearest discrepancies in the numerical results concern aode against the two tree variants. The authors interpret those discrepancies as evidence that variability in cross-validation estimates matters to the conclusions for these pairs.

The comparison changes the statistical specification as well as the inputs. The signed-rank analysis estimates a distribution through randomly weighted observed means. The hierarchy describes variation across datasets with a Student distribution and learns the dataset effects jointly. Its disagreement with the signed-rank analysis therefore demonstrates that the choice of procedure can matter even on the same benchmark. The experiment does not isolate an exact share of the change attributable to the fold correlation, to differences in within-dataset variability, or to partial pooling.

Limitations

Limits the authors state

The interpretation of equivalence depends on the rope. The authors regard 1% in accuracy as a reasonable choice for their example and say that other domains may warrant a different tolerance. Thus the reported probabilities answer a bounded question about a specified practical margin. A reader who considers smaller changes consequential would need to examine the same posterior under a narrower interval. The numerical evidence about effect sizes can be retained even when the boundary for a useful change is reconsidered.

A probability threshold also compresses the underlying estimate. The authors warn that any automatic decision rule loses some of the posterior’s information. The three interval probabilities preserve more of the comparison than a rejection flag, and the plotted posterior can distinguish very different effect sizes within the same region. Two comparisons may both support an advantage with high probability while differing substantially in how large the likely gain is. Likewise, the same unresolved label covers several possible balances among advantage, equivalence and uncertainty.

The treatment of fold dependence relies on an approximation. The authors say that their likelihood cannot identify the shared correlation from the fold differences, and their adopted heuristic comes from a related sampling design. The single-dataset derivation uses the test fraction of the whole dataset for ρ. In the description of the hierarchy, the paper instead writes the ratio of test size to training size for the covariance parameter. The statistical derivation earlier connects the test-to-training ratio with the adjustment term, so the two notations should be read with care. The worked single-dataset example explicitly supplies 1/10. The hierarchy’s main methodological claim is that it retains a dependence structure, with its numerical adjustment tied to the convention used in the fit.

There is a cost to retaining the additional information. The authors prefer the hierarchy when precision differences among datasets may matter and point to the signed-rank procedure when the analysis must be repeated many times, as in feature selection or algorithm racing. The computational comparison is specific to the implementations and benchmark they used. It explains the tradeoff in the paper’s application without providing a general runtime guarantee.

In discussing many pairwise comparisons, the authors use the rope to reduce false alarms from declaring trivial differences important. They also identify a joint hierarchy over multiple classifiers as a direction for further research. The implemented hierarchy shares information across datasets for a given pair. Its results therefore address practical differences in those pairwise comparisons. A common inference over the entire collection of classifiers, with pooling across its comparisons, would be a further statistical construction.

Limits visible in the experiment

The results are a comparison of inferential methods on one benchmark collection and a chosen set of classifiers. The paper reports how frequently each rule makes a declaration on those data. The true accuracy differences for all pairs and datasets are unknown. Thus the 222 Bayesian decisions and the 199 frequentist rejections are counts of outcomes under different definitions. They are not independent evidence that one procedure produced more correct decisions. The Bayesian rule can take a position on practical equivalence, a category absent from the frequentist point-null rejection rule. The additional declared outcomes partly reflect that broader vocabulary.

The hierarchical prediction for a new dataset depends on treating the benchmark datasets as informative about the population from which the next dataset is supposed to come. The paper gives a method for forming that prediction and reports its posterior on the benchmark. It does not test the prediction by evaluating classifiers on an independently drawn collection after fitting the hierarchy. The generalization claim is therefore conditional on the across-dataset distribution and on the relevance of the benchmark to the new task. Datasets selected from a different application may differ both in typical accuracy gaps and in how much those gaps vary.

The same issue appears inside a dataset. The multivariate normal likelihood uses a common variance and a common correlation for all paired splits of that dataset. Actual overlap can differ among splits. The likelihood supplies a workable summary of dependence while its precision estimates remain conditional on that simplification. The hierarchical method lets the variance vary from dataset to dataset, but the benchmark comparison does not show how sensitive the reported outcomes are to other patterns of dependence among folds.

The signed-rank procedure can handle an asymmetric distribution of dataset averages. This advantage leaves intact the distinction between a noisy observed average and the estimand for its dataset. A particularly noisy average can still change the distribution of pair sums used by the procedure. The hierarchical analysis addresses that issue through its observation likelihood, at the cost of assumptions about the population distribution and priors. The different outcomes for aode against the tree variants illustrate the importance of this choice without determining which prediction would be better calibrated on new data.

Finally, the comparisons measure accuracy. A rope in accuracy says how much of that metric a reader is willing to treat as interchangeable for a purpose. The authors discuss related work that can handle multiple performance measures, including accuracy and computational time, but the benchmark here gives no joint comparison on those outcomes. Practical equivalence in accuracy therefore leaves open other reasons to prefer a classifier.

What came after

The paper documents the methods and their accompanying software, with no subsequent study established here. Its forward-looking discussion identifies two directions. One is to analyse several classifiers in a common hierarchy so that the comparisons can share information. The other is to apply Bayesian tests inside learning procedures that already use statistical tests, including algorithm racing and searches for the structure of Bayesian networks. The experiments concern the analysis of classifier results after training. They leave the effects of replacing tests inside those learning procedures as open questions.

Cite

Cite as Alessio Benavoli, Giorgio Corani, Janez Demšar and Marco Zaffalon. 2017. Time for a Change: a Tutorial for Comparing Multiple Classifiers Through Bayesian Analysis. JMLR 18(77):1–36.

The paper itself, not this page. BibTeX from the library's record of the work. arXiv 1606.04316

@inproceedings{benavoli2017time,
  title = {{Time for a Change: a Tutorial for Comparing Multiple Classifiers Through Bayesian Analysis}},
  author = {Alessio Benavoli, Giorgio Corani, Janez Demšar and Marco Zaffalon},
  booktitle = {JMLR 18(77):1–36},
  year = {2017},
  eprint = {1606.04316},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1606.04316}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/benavoli-2017-time-change-tutorial-comparing-multiple/