NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

A Link between Coding Theory and Cross-Validation with Applications

Tapio Pahikkala, Parisa Movahedi, Ileana Montoya, Havu Miikonen, Stephan Foldes, Antti Airola, Laszlo MajorarXiv 2021

This paper explores a fascinating mathematical intersection: the relationship between how well a machine learning algorithm performs under cross-validation and the fundamental limits of error-detecting codes. By bridging these two fields, the authors provide a new theoretical framework for understanding the "capacity" of learning algorithms and develop more robust statistical tests for classification performance.

TL;DR

The authors prove that the maximum number of classification problems a single algorithm can solve with minimal cross-validation error is exactly determined by the theory of constant weight codes. They use this link to develop generalized Wilcoxon-Mann-Whitney tests that remain valid even when an algorithm "learns" from its training data, addressing a common pitfall in statistical significance testing for machine learning.

What Problem Does This Paper Address?

In supervised learning, we often use cross-validation to estimate how well a model generalizes. A common question is: "Is my model's high AUC (Area Under the ROC Curve) score statistically significant, or could I have achieved this by chance?"

The classical tool for this is the Wilcoxon-Mann-Whitney (WMW) U test. However, the WMW test assumes the prediction function is fixed and independent of the labels. In reality, machine learning algorithms learn from labels. This "inductive bias" means that under a null hypothesis (where labels are random), an algorithm might still find patterns by chance, making the standard WMW p-values overly optimistic.

The authors tackle the challenge of bounding this "luck" by asking a fundamental question: How many different ways can you label a dataset such that a single algorithm can solve all of them perfectly (or near-perfectly) according to Leave-Pair-Out Cross-Validation (LPOCV)?

Methods

The paper establishes a formal bijection between machine learning performance and coding theory:

  1. The Coding Link: The authors show that achieving zero LPOCV error on a set of binary labeling problems is equivalent to finding a Constant Weight Code (CWC). In these codes, every codeword has the same number of "1"s, and they are spaced far enough apart (Hamming distance) to detect errors.
  2. Johnson Graphs: They model the space of all possible dataset labelings as a Johnson Graph $J(n, w)$. In this graph, each vertex is a labeling, and edges connect labelings that differ by a single swap of a 0 and a 1. A learning algorithm’s behavior is represented as an orientation of this graph (turning edges into directed arrows).
  3. Light CWCs: To handle cases with non-zero errors, the authors introduce "W-light constant weight codes." These represent sets of labelings where the algorithm makes at most $W$ errors.
  4. Supremum P-values: Using these combinatorial bounds, they propose a "supremum" approach to significance testing. Instead of comparing a result to a single distribution, they compare it to the "worst-case" distribution across all possible symmetric learning algorithms.

Datasets

The authors validated their theoretical findings using both synthetic and real-world data:

  • Synthetic Data: They generated 1D and 10D datasets using standard normal distributions and mixtures of normals to create empirical tables of "critical values" for their new tests.
  • Real-World Medical Data: They used a prostate cancer MRI dataset (Diffusion Weighted Imaging). The task was to classify voxels as cancerous or non-cancerous based on six imaging features. This served as a benchmark to see how the new tests perform on complex, high-dimensional biological data.

Key Insights and Ideas

  • Cross-Validation as Graph Orientation: The most elegant insight is that every possible outcome of a cross-validation experiment for a specific algorithm can be viewed as a specific way to point the arrows on a Johnson graph. The "outdegree" of a vertex in this graph is exactly the number of cross-validation errors.
  • The Limits of Learning: The No-Free-Lunch theorem tells us we can't be good at everything. This paper quantifies that limit: the number of problems you can be "good" at is strictly bounded by the maximum size of an error-detecting code of a certain length and weight.
  • Generalizing the WMW Test: The paper demonstrates that the standard WMW distribution (shown in Figure 1) is just one specific case.
Figure 1: The distribution of U-values under the null hypothesis for a sample of size 30 of which 15 labeled with one and a fixed prediction function. This is also known as the Wilcoxon’s distribution and it determines the critical values for the WMW-test. The red dashed line denotes the significance level 0.05, that is, 5% of the probability mass is on the left side of the line.

As shown in the figure above, the WMW distribution is bell-shaped. However, the authors show that for learning algorithms, this distribution can spread out or shift, meaning we need the more conservative "LPO critical values" derived in this paper to avoid false positives.

Key Results

  • Theoretical Bounds: The authors successfully derived both upper and lower bounds for the size of "light" constant weight codes, providing a theoretical ceiling on how many problems an algorithm can solve.
  • New Statistical Tables: They produced new tables of critical values (similar to standard Z-tables or T-tables) specifically for LPOCV. These tables allow researchers to check if their AUC is truly significant while accounting for the fact that their model was trained on the data.
  • Empirical Validation: Simulations with Ridge Regression and k-Nearest Neighbors (kNN) confirmed that these algorithms indeed produce wider null distributions than the classical WMW test assumes, justifying the need for the authors' more conservative approach.

Limitations and Future Work

  • Tightness of Bounds: The authors note that their current bounds for light CWCs are not yet "tight" (perfectly exact). There is room for improvement in the combinatorial formulas.
  • Conservatism: The "supremum" approach is very safe but can be too conservative (low power). If you use this test, you are less likely to claim a false discovery, but you might also miss a real one.
  • Scaling Up: The current work focuses on Leave-Pair-Out (holding out 2 items). The authors suggest that future work could extend this to larger hold-out sets (like k-fold cross-validation), which would correspond to codes with larger Hamming distances.

Summary updated

BibTeX
@misc{pahikkala2021link,
  author = {Tapio Pahikkala and Parisa Movahedi and Ileana Montoya and Havu Miikonen and Stephan Foldes and Antti Airola and Laszlo Major},
  title = {{A Link between Coding Theory and Cross-Validation with Applications}},
  year = {2021},
  eprint = {2103.11856},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2103.11856},
}
Figure