Typical Angina, Reversed: A Long-Standing Documentation Error in the UCI Heart Disease Data

Tejas Tovinkere Pattabhi

TL;DR

For over three decades, one of machine learning’s most iconic benchmarks—the UCI Heart Disease dataset—has carried a backwards documentation error: the codes for chest-pain types are completely reversed, labeling severe chest pain as "asymptomatic" and vice versa. While classical predictive models didn't care about the swapped labels, modern explainable AI studies and zero-shot large language models (LLMs) certainly do, leading researchers to publish—and clinically rationalize—upside-down medical conclusions.

What Problem Does This Paper Address?

If you have ever taken an introductory data science course or tested a tabular classifier, you have likely met the 1980s UCI Heart Disease dataset. According to its documentation, chest-pain type (cp) is coded from 1 (typical angina—classic, exertion-triggered heart pain) to 4 (asymptomatic—no chest pain).

Read literally, the Cleveland dataset makes a baffling medical claim: 72.9% of "asymptomatic" patients have coronary artery disease (CAD), compared to just 30.4% of patients with "typical angina." This flips a foundational rule of cardiology on its head. The author investigates a deceptively simple question: are these patients medical anomalies, or has the documentation been backwards since at least 1990? More importantly, in an era of explainable AI and text-reading LLMs, what happens when a silent documentation bug sits at the heart of a benchmark?

Methods

Rather than proposing a new algorithm, this paper performs rigorous data forensics, a systematic literature audit, and empirical model probing:

  • Provenance Forensics: For the Cleveland subset (whose raw 76-attribute file is corrupted), the author refitted logistic regressions and cross-tabulated patient counts against the original 1986 cardiology study by Detrano et al. For the other three hospital sites, the author cross-checked the processed cp codes directly against raw clinical attributes recording the three textbook features of angina (substernal location, exertion-triggered, relieved by rest).
  • Downstream Tracking & Literature Audit: The author matched patient rows across popular repositories to trace how the labels spread, and audited a seeded random sample of 150 Google Scholar papers (124 readable) using SHAP (SHapley Additive exPlanations—a standard method for attributing how much each feature pushes a model's prediction up or down) on these data.
  • Model Probes: The author compared classical ML models (logistic regression, random forests, gradient boosting) against three 4-bit quantized, open-weight LLMs (Qwen2.5-7B, Llama-3.1-8B, Phi-3.5-mini) tasked with zero-shot CAD prediction by reading serialized text descriptions of the patients.

Datasets

No new datasets are introduced, though the author provides the corrected mapping ($5 - \text{cp}$) for existing benchmarks:

  • UCI Heart Disease Data: Collected across four sites (Cleveland, Budapest/Hungarian, Switzerland, and Long Beach), including raw 76-attribute files and a 1990 word-labeled file (cleve.mod).
  • Downstream Derivatives: Statlog (Heart) (a 270-row Cleveland subset), OpenML (heart-c, heart-h), Penn Machine Learning Benchmarks (PMLB), and top-voted Kaggle copies totaling hundreds of thousands of downloads.

Key Insights and Ideas

  • Why the bug survived 36 years: Standard tabular models (like trees or one-hot regressions) treat categorical codes as arbitrary symbols; swapping 1 and 4 leaves predictive accuracy untouched. Benchmarking alone cannot catch semantic inversions.
  • The "Explainable AI" trap: When researchers apply interpretability tools like SHAP to inverted labels, the math faithfully reports that "asymptomatic" drives up disease risk. Rather than questioning the data, human analysts frequently invent plausible-sounding clinical stories (e.g., "silent killers go unnoticed") to rationalize the backwards output.
  • To an LLM, documentation is data: Unlike random forests, zero-shot tabular LLMs read category names as English words and lean on prior medical knowledge. Feeding them reversed labels actively pits the data against their world knowledge.
  • Compounding chaos on Kaggle: One massively popular 1,025-row Kaggle copy (386K downloads) not only consists of duplicated Cleveland patients, but swaps the end chest-pain codes and reverses the disease target variable—creating a double-negative where two errors occasionally cancel out in downstream papers.

Key Results

  • Smoking-gun proof of reversal: Refitting the 1986 Cleveland study’s logistic regression reproduces the published pain slope ($-1.10$) and constant ($-2.29$) to two decimal places only when chest pain is entered as $5 - \text{cp}$. In the raw files for Budapest, Switzerland, and Long Beach, 93–96% of patients coded 4 ("asymptomatic") actually exhibit all three classical angina symptoms.
Table 1: Logistic regression of CAD on age, sex and chest pain in the Cleveland data (303 patients): coefficients published by Detrano et al. [5] (Table 8, subset 1) and refitted on the UCI file with cp as stored and corrected (5 −cp).
Table 2: Classical angina features (substernal, exertional, relieved by rest) by stored chest-pain code, in the raw records of three UCI sites. Each cell gives the number of patients with 0, 1, 2 or 3 of the features, among patients with all three recorded. Full tables for all four codes are in the repository.
  • Literature impact: None of the 124 audited papers caught the error. Of 32 papers stating a risk direction for a named category, 25 (78%) stated a clinically backwards direction, 22 (69%) were directly attributable to the UCI documentation error, and 9 explicitly rationalized the error with clinical explanations.
  • Classical vs. LLM performance: Relabeling cp changes classical model AUC (Area Under the ROC Curve, where 0.5 is random guessing and 1.0 is perfect ranking) by at most $0.002$. However, for zero-shot LLMs given age, sex, and chest pain ("minimal" template), fixing the labels boosts AUC by 0.12 to 0.33 across all three models. Under the buggy labels, Qwen2.5-7B drops to 0.458 AUC—worse than a coin flip, and worse than omitting chest pain entirely.
Table 4: LLM probe on Cleveland (303 patients). AUC under documented (D) and corrected (C) labels, and differences C−D with paired-bootstrap 95% intervals (2,000 resamples).

Limitations and Future Work

  • Audit scope & single coder: The literature query specifically targeted papers mentioning "SHAP" and "asymptomatic," which likely inflates the rate of backwards directional claims compared to the broader ML literature. Furthermore, claims buried solely in figures were skipped, 17% of sampled papers were inaccessible, and only one author coded the texts (a blinded second coding is planned).
  • Modest full-template LLM effects & protocol deviations: When LLMs were given all 13 clinical predictors ("full" template), AUC gains from fixing the labels were much smaller (+0.002 to +0.077), and small 4-bit quantized models were used in a single prompt format. Because pre-specified scale-up thresholds weren't met on the full template, planned replications on the Hungarian subset and larger LLMs were omitted.
  • Next steps: Dataset maintainers across UCI, Kaggle, OpenML, and PMLB need to patch their metadata, and researchers using these benchmarks for clinical interpretability should revisit their conclusions.

Summary updated

BibTeX
@misc{pattabhi2026typical,
  author = {Tejas Tovinkere Pattabhi},
  title = {{Typical Angina, Reversed: A Long-Standing Documentation Error in the UCI Heart Disease Data}},
  year = {2026},
  eprint = {2611.33248},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.33248},
}
Figure