[Paper Review] Confound-leakage: Confound Removal in Machine Learning Leads to Leakage
This paper demonstrates that standard confound removal via linear regression (confound regression, CR) in machine learning pipelines can inadvertently cause data leakage, especially when followed by nonlinear models. The leakage leads to spurious, near-perfect prediction performance by revealing hidden confounding information in residuals, undermining model validity in clinical and observational studies.
Machine learning (ML) approaches to data analysis are now widely adopted in many fields including epidemiology and medicine. To apply these approaches, confounds must first be removed as is commonly done by featurewise removal of their variance by linear regression before applying ML. Here, we show this common approach to confound removal biases ML models, leading to misleading results. Specifically, this common deconfounding approach can leak information such that what are null or moderate effects become amplified to near-perfect prediction when nonlinear ML approaches are subsequently applied. We identify and evaluate possible mechanisms for such confound-leakage and provide practical guidance to mitigate its negative impact. We demonstrate the real-world importance of confound-leakage by analyzing a clinical dataset where accuracy is overestimated for predicting attention deficit hyperactivity disorder (ADHD) with depression as a confound. Our results have wide-reaching implications for implementation and deployment of ML workflows and beg caution against naïve use of standard confound removal approaches.
Motivation & Objective
- To investigate the unintended consequences of standard confound removal via linear regression in machine learning workflows.
- To identify conditions under which confound removal leads to data leakage in nonlinear models, particularly in clinical applications.
- To evaluate whether increased model performance after confound removal reflects true signal enhancement or spurious leakage.
- To provide practical guidelines for detecting and mitigating confound-leakage in ML pipelines.
- To demonstrate the real-world impact of confound-leakage using a clinical ADHD speech dataset with depression as a confound.
Proposed method
- Applied confound regression (CR) to remove linear variance of confounds (e.g., age, gender, depression) from features using linear models.
- Used a cross-validation-consistent workflow to ensure CR was applied only to training folds, preserving test set integrity.
- Evaluated a range of ML models—linear and nonlinear—on both benchmark and clinical datasets to compare performance with and without CR.
- Measured performance using AUC-ROC for classification and R² for regression in 10×5 nested cross-validation.
- Assessed the predictability of the confound estimates ($\hat{X}$) from the CR step to detect leakage: high predictability of target from $\hat{X}$ indicates leakage.
- Used Bayesian ROPE analysis to determine meaningful differences in performance between CR and non-CR pipelines.
Experimental results
Research questions
- RQ1Does confound removal via linear regression lead to data leakage when followed by nonlinear machine learning models?
- RQ2Under what conditions is the performance gain after confound removal due to information revelation versus confound-leakage?
- RQ3How predictable is the confound estimate ($\hat{X}$) from the residualized features, and what does this imply about leakage?
- RQ4To what extent does confound-leakage overestimate diagnostic accuracy in real-world clinical applications, such as ADHD prediction?
- RQ5Can feature shuffling and prediction of confounds from residuals serve as a practical diagnostic tool for detecting leakage in ML pipelines?
Key findings
- Confounding removal via linear regression followed by nonlinear models leads to spurious, near-perfect prediction performance due to confound-leakage, even when the true effect is null or weak.
- In the ADHD speech dataset, CR increased AUC-ROC for ADHD prediction from ~0.65 to ~0.95 when depression was used as a confound, indicating severe overestimation of model performance.
- The residualized features after CR were highly predictive of the confound (e.g., depression score), with $\hat{X}$ explaining up to 80% of the variance in the target, providing strong evidence of leakage.
- Performance gains after CR were not due to signal enhancement but were instead driven by leakage, as shown by the high predictability of the confound from the residuals.
- The study found that confound-leakage is particularly prevalent when nonlinear models are applied after univariate confound regression, even in cross-validated pipelines.
- The authors propose that feature shuffling and prediction of confounds from residuals can serve as a diagnostic tool to detect leakage susceptibility in ML workflows.
Better researchstarts right now
From reading papers to final review, dramatically reduce your research time.
No credit card · Free plan available
This review was created by AI and reviewed by human editors.