Code for Hardtack: An Explainable Hybrid Stacking Ensemble for Heart Disease Prediction
Abstract— Clinical routine tests can be used for risk prediction which can aid to early screening of heart disease; however, published studies of machine learning have been performed on a single small cohort, a single train-test split and black-box models. This paper introduces the Hardtack model, an explainable hybrid stacking ensemble of seven base models from three model families (linear and kernel, tree ensemble, neural) using an out-of-fold probabilities based logistic regression meta-learner. If an impossible zero value is given it is considered as missing data and all the preprocessing is done within the training folds to avoid leakage. When tested in a public benchmark of 918 patients across five cohorts, Hardtack performed best when compared to eleven models on the public benchmark with a mean accuracy of 88.09% and an F1-score of 89.48%, and AUC of 0.934, with under three repetitions of stratified 10-fold cross-validation. Based on a corrected resampled t-test, it significantly outperformed the decision tree, multilayer perceptron, but was not statistically significant compared to random forest, XGBoost and soft voting. ST-segment slope and chest pain type and exercise induced angina were the key predictors identified by SHAP analysis. Subgroup analysis found reduced sensitivity in women (78.0%) as compared to men (93.2%) and also demonstrated that missing cholesterol measurements were also predictive, a dataset artefact that needs to be taken into account before deployment. All code and data are available and open.
Authors
- Arooba Mansoor
- Muhammad Zulkifil Hassan
- Syed Muhammad Measum ALi Rizvi
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-14
- DOI
- https://doi.org/10.5281/zenodo.24230230
- Primary Topic
- Artificial Intelligence in Healthcare
- Type
- article
- Field-Weighted Citation Impact
- 0.00