GQ / lab logES / EN
← Back to the log

2026

Heart disease prediction with ensembles and cross-validation

A comparison of VotingClassifier, Random Forest and Extra Trees on the Heart Cleveland clinical dataset, plus a regularization study with 20-fold cross-validation.

Heart disease prediction with ensembles and cross-validation

Problem

Predict the presence of heart disease from 13 clinical variables.

Data

Heart Disease Cleveland (UCI): 297 patients and 13 clinical variables (age, sex, chest-pain type, blood pressure, cholesterol, max heart rate, etc.). The target is `condition` (disease present). The CSV is not included in the repo.

Method

EDA, scaling, 5-fold GridSearchCV for each ensemble, and depth limits to control tree overfitting.

Result

An L1-regularized logistic regression scored best (83.8% 20-fold cross-validated accuracy), ahead of every ensemble. The best ensemble was the soft VotingClassifier (82.2%), followed by Extra Trees (79.5%) and Random Forest (77.1%).

Stack

  • Python
  • scikit-learn
  • pandas
  • Seaborn

Context

Course: Machine Learning II · 2026

View the code on GitHub ↗