Inference for the Generalization Error

Yoshua Bengio, Claude NadeauÉrudit 1999

Abstract

We consider the estimation of generalization error via cross-validation. We perform a theoretical study of the variance of this estimator, accounting for variability due to the choice of training sets and test examples. This allows us to propose two new variance estimators. Simulations show these new statistics perform well compared to those in Dietterich (1998), providing powerful hypothesis tests without being overly liberal.

Introduction

When evaluating machine learning algorithms, cross-validation (CV) is the standard tool for estimating generalization error. However, estimating the variance of this error is notoriously difficult. Standard statistical tests often assume independent observations, but in CV, training sets overlap significantly across folds. This overlap creates hidden correlations that lead standard tests to be "liberal"—frequently claiming a significant difference between algorithms when none exists (a high Type I error rate).

The Theoretical Challenge: A "No-Go" Theorem

The core of the problem lies in the structure of the variance. The total variance of a CV estimator is composed of the variance of individual test errors, the variance across different training set splits, and the covariances between errors within and across those splits.

A key contribution of this research is a "no-go" theorem: there is no general, unbiased, non-negative estimator of the variance of cross-validation. Because the data is reused, any practical estimator must rely on approximations. Ignoring these correlations leads to an underestimation of the true variance, which is why traditional $t$-tests often fail in a machine learning context.

Proposed Methods

To address these limitations, two new approaches are proposed to provide more "honest" estimates of a model's generalization error:

1. The Corrected Resampled $t$-test

The standard resampled $t$-test is typically too optimistic because it ignores the correlation between training sets. The authors introduce a correction factor based on the ratio of the test set size ($n_2$) to the total dataset size ($n$). By adjusting the variance estimator to $(\frac{1}{J} + \frac{n_2}{n_1})S^2$, where $J$ is the number of resamples, the test accounts for the overlap in training data. This simple heuristic correction significantly improves the reliability of the test without complex calculations.

2. The Conservative Z

For scenarios where safety is paramount, the Conservative Z method is designed to intentionally overestimate variance. By splitting the data into two independent halves and using the difference to bound the variance, this method ensures that the resulting inference is "conservative." It is the best choice for researchers who want to be absolutely sure they aren't overstating their results.

Empirical Validation

The proposed estimators were tested against synthetic and semi-synthetic datasets, including Gaussian populations and the UCI Letter Recognition dataset. These controlled environments allowed for a comparison against the "ground truth" generalization error.

The results demonstrated that:

  • Standard tests are risky: Traditional resampled $t$-tests and McNemar’s test showed Type I error rates 2-3 times higher than the nominal 5% level.
  • The Correction is Effective: The Corrected Resampled $t$-test maintained error rates close to intended levels while offering higher statistical power than existing benchmarks like Dietterich’s $5 \times 2$ cv.
  • Conservative Z is Safe: This method almost never exceeded the nominal error rate, providing a robust "floor" for statistical significance.

Conclusion

Estimating the reliability of a learning algorithm requires more than just an average error rate. By accounting for the inherent correlations in cross-validation, the Corrected Resampled $t$-test and the Conservative Z provide researchers with more reliable tools for model comparison. For most applications, $J=15$ resamples provides an optimal balance between statistical accuracy and computational efficiency.

Summary updated

BibTeX
@inproceedings{bengio1999inference,
  author = {Yoshua Bengio and Claude Nadeau},
  title = {{Inference for the Generalization Error}},
  booktitle = {Érudit},
  year = {1999},
}
Figure