medrxiv.org
Class imbalance correction in artificial intelligence models leads to miscalibrated clinical predictions: a real-world evaluation
Background Predictive models employing machine learning algorithms are increasingly being used in clinical decision making, and improperly calibrated models can result in systematic harm. We sought to investigate the impact of class imbalance correction, a commonly applied preprocessing step in machine learning model development, on calibration and modelled clinical decision making in a large real-world context.
Methods A histogram boosted gradient classifier was trained on a highly imbalanced national dataset of > 1.8 million patients undergoing surgery, to predict the risk of 90-day mortality and complications after surgery. Class imbalance correction strategies including random oversampling, synthetic minority oversampling technique, random under-sampling, and cost-sensitive learning were compared to the natural distribution (‘natural’). Models were tested and compared with classification metrics, calibration plots, decision curve analysis, and simulated clinical impact analysis.
Results The natural model demonstrated high performance (AUROC 0.94, 95% CI 0.94–0.95 for mortality; 0.84, 95% CI 0.84–0.85 for complications) and calibration (log loss 0.05, 95% CI 0.04–0.05 for mortality; 0.23, 95% CI 0.23–0.24 for complications). Class imbalance mitigation (CSL, ROS, RUS, and SMOTE) did not improve AUROC or AUPRC but increased recall and F1 scores at the expense of precision and accuracy. However, these methods severely compromised model calibration, leading to significant over-prediction of risks (up to a 62.8 % increase) as further evidenced by increased log loss across all mitigation techniques. Decision curve analysis and clinical scenario testing confirmed that the natural model provided the highest net benefit.
Conclusion Class imbalance correction methods result in significant miscalibration, leading to possible harm when used for clinical decision making.
### Competing Interest Statement
The authors have declared no competing interest.
### Funding Statement
This work was funded by the Health Research Council of New Zealand 2025 Artificial Intelligence (AI) in Healthcare Project Grant.
### Author Declarations
I confirm all relevant ethical guidelines have been followed, and any necessary IRB and/or ethics committee approvals have been obtained.
Yes
The details of the IRB/oversight body that provided approval or exemption for the research described are given below:
Ethical approval was obtained from the Auckland Health Research Ethics Committee (AH29056).
I confirm that all necessary patient/participant consent has been obtained and the appropriate institutional forms have been archived, and that any patient/participant/sample identifiers included were not known to anyone (e.g., hospital staff, patients or participants themselves) outside the research group so cannot be used to identify individuals.
Yes
I understand that all clinical trials and any other prospective interventional studies must be registered with an ICMJE-approved registry, such as ClinicalTrials.gov. I confirm that any such study reported in the manuscript has been registered and the trial registration ID is provided (note: if posting a prospective study registered retrospectively, please provide a statement in the trial ID field explaining why the study was not registered in advance).
Yes
I have followed all appropriate research reporting guidelines, such as any relevant EQUATOR Network research reporting checklist(s) and other pertinent material, if applicable.
Yes
Data can be obtained from the New Zealand Ministry of Health National Collections team. Requests can be made by contacting data-enquiries{at}health.govt.nz. A Python package was created to create training and evaluation pipelines and is freely available on Github at <<https://github.com/Surgical-Recovery-and-Safety-Lab/medpipe>>. The code used to train the models and create the figures is freely available on GitHub at <https://github.com/Surgical-Recovery-and-Safety-Lab/AI-risk-score>.