Cardiovascular diseases and heart attacks remain significant global healthcare challenges. Early identification of individuals at risk can support timely medical intervention and improve healthcare decision-making.
This research presents a comparative Machine Learning framework for predicting heart attack risk by integrating systematic data preprocessing, feature preparation, class imbalance handling, hyperparameter optimization, and five-fold cross-validation.
Seven supervised machine learning algorithms are investigated to compare their predictive capabilities and identify their strengths and limitations in healthcare risk prediction.
The research particularly emphasizes the importance of evaluating models beyond accuracy, considering metrics such as Recall, Precision, F1-Score, ROC-AUC, and Confusion Matrices.
Research Focus: Developing and evaluating a systematic machine learning framework that emphasizes reliable heart attack risk prediction and minority-class detection.
The primary objectives of this research include:
- ๐ซ Developing a comparative machine learning framework for heart attack risk prediction.
- ๐งน Applying systematic data preprocessing and cleaning.
- ๐ Identifying relevant predictive features.
- โ๏ธ Addressing class imbalance using SMOTE and class weighting.
- ๐ค Comparing multiple supervised machine learning algorithms.
- โ๏ธ Optimizing model hyperparameters.
- ๐ Applying five-fold cross-validation.
- ๐ Evaluating predictive performance using multiple metrics.
- โค๏ธ Investigating minority-class detection capabilities.
- ๐ Identifying the strengths and limitations of different models.
The research utilizes the Heart Attack Risk Prediction Dataset obtained from Kaggle.
Heart Attack Risk
The prediction task is formulated as a binary classification problem.
| Target Value | Description |
|---|---|
| 0 | No Heart Attack Risk |
| 1 | Heart Attack Risk |
The dataset includes demographic, physiological, lifestyle, and clinical-related variables.
| Category | Features |
|---|---|
| ๐ค Demographic | Age, Sex |
| โค๏ธ Cardiovascular | Cholesterol, Systolic BP, Diastolic BP |
| ๐ฌ Lifestyle | Smoking, Alcohol Consumption, Exercise |
| ๐ฉบ Medical | Diabetes, Family History, Previous Heart Problems |
| โ๏ธ Physical | BMI, Obesity |
| ๐ง Other Factors | Stress Level, Sleep, Physical Activity |
| Property | Details |
|---|---|
| Dataset | Heart Attack Risk Prediction |
| Source | Kaggle |
| Problem Type | Binary Classification |
| Target Variable | Heart Attack Risk |
| Original Observations | 5,022 |
| Original Class Distribution | 2,511 per class |
The study follows a quantitative machine learning research methodology.
The proposed framework integrates data preprocessing, feature selection, class balancing, model development, optimization, and performance evaluation.
๐ซ HEART ATTACK DATASET
|
โผ
๐งน DATA PREPROCESSING
|
โผ
๐ FEATURE SELECTION
|
โผ
โ๏ธ CLASS IMBALANCE
HANDLING
|
โโโโโโโโโโดโโโโโโโโโ
โผ โผ
SMOTE CLASS WEIGHTING
โโโโโโโโโโฌโโโโโโโโโ
|
โผ
๐ค MODEL TRAINING
|
โผ
โ๏ธ HYPERPARAMETER
OPTIMIZATION
|
โผ
๐ FIVE-FOLD CV
|
โผ
๐ EVALUATION
|
โผ
๐ MODEL COMPARISON
|
โผ
๐ซ RISK PREDICTION
The dataset was divided into 80% training and 20% testing data, with five-fold cross-validation used for model validation.
Data preprocessing is an essential stage in developing reliable machine learning models.
The research examines several data preparation activities:
- Handling missing values.
- Identifying duplicate records.
- Examining inconsistent observations.
- Investigating potential outliers.
- Performing feature preparation.
- Applying feature selection.
- Preparing data for machine learning algorithms.
The objective is to improve data quality and establish a consistent foundation for model training and evaluation.
Class imbalance can affect the ability of machine learning models to identify minority-class observations.
This research incorporates two important approaches:
SMOTE generates synthetic minority-class observations to improve class representation during model training.
Class weighting assigns different importance to classes during model training to help address classification bias.
| Class | Original Distribution | After SMOTE |
|---|---|---|
| No Heart Attack Risk (0) | 2,511 | 4,499 |
| Heart Attack Risk (1) | 2,511 | 4,499 |
Important: SMOTE is applied to training data rather than the held-out test data to avoid data leakage.
The research compares seven supervised machine learning algorithms.
| No. | Algorithm | Category |
|---|---|---|
| 01 | ๐ Logistic Regression | Linear Classification |
| 02 | ๐ณ Decision Tree | Tree-Based Learning |
| 03 | ๐ฒ Random Forest | Ensemble Learning |
| 04 | ๐ Gradient Boosting | Boosting Algorithm |
| 05 | โก LightGBM | Gradient Boosting |
| 06 | ๐ฅ AdaBoost | Adaptive Boosting |
| 07 | ๐ง Multi-Layer Perceptron (MLP) | Neural Network |
A statistical classification algorithm used as a baseline for predicting binary outcomes.
A tree-based learning algorithm that identifies patterns and relationships through decision rules.
An ensemble learning technique that combines multiple decision trees to improve prediction robustness.
A boosting approach that sequentially develops models to improve predictive performance.
An efficient gradient-boosting framework designed for scalable tree-based learning.
An adaptive boosting algorithm that focuses on observations incorrectly classified by previous learners.
A neural network architecture capable of learning complex nonlinear relationships in structured data.
Hyperparameter optimization is incorporated to identify suitable configurations for the machine learning algorithms.
The process aims to improve model performance and establish more effective model configurations.
MACHINE LEARNING MODEL
|
โผ
HYPERPARAMETER SEARCH
|
โผ
MODEL VALIDATION
|
โผ
FIVE-FOLD CROSS-VALIDATION
|
โผ
OPTIMIZED CONFIGURATION
|
โผ
FINAL EVALUATION
Five-fold cross-validation is used to assess model performance across different subsets of the training data.
FOLD 1 โ TRAIN / VALIDATE
FOLD 2 โ TRAIN / VALIDATE
FOLD 3 โ TRAIN / VALIDATE
FOLD 4 โ TRAIN / VALIDATE
FOLD 5 โ TRAIN / VALIDATE
|
โผ
AVERAGE PERFORMANCE
This approach provides a more comprehensive assessment of model performance than relying exclusively on a single validation split.
Healthcare prediction requires careful evaluation because identifying high-risk cases is particularly important.
The research incorporates multiple performance metrics.
| Metric | Purpose |
|---|---|
| ๐ฏ Accuracy | Overall classification correctness |
| ๐ Precision | Correctness of positive predictions |
| โค๏ธ Recall | Ability to identify actual positive cases |
| โ๏ธ F1-Score | Balance between precision and recall |
| ๐ ROC-AUC | Discrimination between positive and negative classes |
| ๐งฉ Confusion Matrix | Detailed classification outcomes |
| ๐ Balanced Accuracy | Performance across both classes |
The experimental findings demonstrate that different algorithms perform differently depending on the evaluation criteria.
| Machine Learning Model | Approx. Accuracy | Key Observation |
|---|---|---|
| ๐ฒ Random Forest | 64% | Strong overall classification |
| ๐ Logistic Regression | 64% | Competitive overall performance |
| ๐ Gradient Boosting | 63% | Strong ensemble performance |
| โก LightGBM | 62% | Competitive predictive performance |
| ๐ณ Decision Tree | 54% | Better minority-class detection |
| ๐ง MLP Neural Network | 54% | Better heart attack case detection |
Values are approximate and based on the reported experimental results.
An important finding is that the algorithm achieving the highest overall accuracy is not necessarily the most effective at identifying heart attack-risk cases.
The Decision Tree and MLP Neural Network demonstrated comparatively stronger minority-class detection through higher Recall and F1-Score.
Random Forest achieved approximately:
| Metric | Performance |
|---|---|
| Accuracy | 64.3% |
| Precision | 49.4% |
The reported ROC-AUC values were relatively close to random classification.
This indicates that the models demonstrated limited class-separation capability on the evaluated dataset.
Accuracy alone is insufficient for evaluating healthcare prediction models. Recall, Precision, F1-Score, and ROC-AUC provide additional insights into the ability of models to identify high-risk cases.
The primary contribution of this research is the development of a systematic comparative machine learning framework integrating:
- ๐งน Comprehensive data preprocessing.
- ๐ Feature selection.
- โ๏ธ Class imbalance handling.
- โ๏ธ Hyperparameter optimization.
- ๐ Five-fold cross-validation.
- ๐ Multi-metric performance evaluation.
- ๐ค Comparative analysis of seven machine learning algorithms.
The findings highlight the importance of evaluating machine learning models using multiple performance indicators rather than relying exclusively on accuracy.
| Technology | Purpose |
|---|---|
| ๐ Python | Machine learning implementation |
| ๐ Jupyter Notebook | Experimental development |
| ๐ผ Pandas | Data processing |
| ๐ข NumPy | Numerical computation |
| ๐ค Scikit-learn | Machine learning algorithms |
| โ๏ธ Imbalanced-learn | SMOTE and class balancing |
| ๐ Matplotlib | Data visualization |
| ๐จ Seaborn | Statistical visualization |
| ๐ Plotly | Interactive visualization |
| ๐ SPSS | Statistical analysis |
A-Comparative-Machine-Learning-Framework/
โ
โโโ ๐ A Comparative Machine Learning Framework for
โ Heart Attack Risk Prediction.docx
โ
โโโ ๐ Data-Analysis-with-Python.ipynb
โ
โโโ ๐ Heart_Attack_Risk_Levels_Dataset.csv
โ
โโโ ๐ README.md
The research manuscript is also available on ResearchGate for academic accessibility and research dissemination.
A Comparative Machine Learning Framework for Heart Attack Risk Prediction Using Data Preprocessing, Class Imbalance Handling, and Cross-Validation.
Potential directions for extending this research include:
- ๐ฌ External validation using independent healthcare datasets.
- ๐ง Integration of Explainable AI (XAI) techniques.
- ๐ SHAP-based feature importance analysis.
- โก Advanced ensemble learning approaches.
- ๐ฉบ Investigation of additional cardiovascular risk factors.
- ๐ Advanced feature selection techniques.
- ๐ Model calibration and threshold optimization.
- ๐ Development of an interactive prediction interface.
These are potential research extensions and are not claimed as completed implementations.
The experimental framework was designed to evaluate multiple machine learning algorithms under a consistent data preparation and validation strategy.
| Configuration | Description |
|---|---|
| ๐ฏ Learning Task | Binary Classification |
| ๐ Dataset | Heart Attack Risk Prediction |
| ๐ Train-Test Split | 80:20 |
| ๐ Cross-Validation | 5-Fold |
| โ๏ธ Imbalance Handling | SMOTE and Class Weighting |
| ๐ค Algorithms | 7 Machine Learning Models |
| ๐ Evaluation | Multiple Classification Metrics |
| ๐ Programming Language | Python |
- Consistent preprocessing across model experiments.
- Training and testing data separation.
- Class imbalance handling within the training process.
- Hyperparameter optimization.
- Cross-validation-based performance assessment.
- Comparative evaluation of classification results.
Research Principle: Fair model comparison requires consistent experimental conditions, appropriate validation, and reliable performance evaluation.
Machine learning models are evaluated using multiple performance indicators to understand their classification capabilities.
| Evaluation Metric | Research Importance |
|---|---|
| ๐ฏ Accuracy | Overall predictive correctness |
| ๐ Precision | Reliability of positive predictions |
| โค๏ธ Recall | Identification of actual positive cases |
| โ๏ธ F1-Score | Balance between Precision and Recall |
| ๐ ROC-AUC | Classification discrimination |
| ๐งฉ Confusion Matrix | Classification error analysis |
The comparative analysis highlights an important distinction between overall classification accuracy and minority-class identification.
A model with higher accuracy does not necessarily provide better detection of heart attack-risk cases.
Therefore, Recall and F1-Score are particularly important when interpreting the predictive performance of healthcare classification models.
Key Insight: Model selection should consider the intended application and the relative importance of false negatives and false positives, rather than accuracy alone.
Reproducibility is an important aspect of scientific machine learning research.
This repository provides supporting research materials to help readers understand the experimental methodology and research framework.
| Resource | Purpose |
|---|---|
| ๐ Research Manuscript | Research methodology and findings |
| ๐ Jupyter Notebook | Experimental implementation |
| ๐ Dataset | Supporting data for analysis |
| ๐ README Documentation | Project overview and methodology |
The repository is intended to support:
- Understanding the experimental workflow.
- Reviewing the machine learning methodology.
- Examining the selected classification algorithms.
- Exploring preprocessing and class balancing strategies.
- Understanding model evaluation and reported findings.
Reproducibility depends on using the same dataset version, preprocessing operations, feature configuration, random seeds, and model settings described in the research.
Although this research investigates multiple machine learning approaches for heart attack risk prediction, several limitations should be considered.
- Dataset Dependency: Experimental findings depend on the characteristics and quality of the selected dataset.
- Generalizability: Results may not directly generalize to different populations or healthcare environments.
- Class Discrimination: Relatively low ROC-AUC performance indicates limitations in distinguishing between the two classes.
- Feature Dependency: Predictive performance may depend on the availability and quality of input variables.
- Clinical Validation: The experimental framework has not established clinical effectiveness through independent real-world validation.
These considerations highlight the need for independent datasets, improved feature engineering, advanced machine learning methods, explainability techniques, and clinical validation.
Research Perspective: Machine learning predictions should be interpreted carefully, particularly in high-impact healthcare applications.
This research contributes to the broader investigation of machine learning applications in healthcare risk prediction.
- ๐ Provides a comparative investigation of seven machine learning algorithms.
- ๐งน Highlights the importance of systematic data preprocessing.
- โ๏ธ Examines class imbalance handling in healthcare classification.
- ๐ Incorporates cross-validation into model evaluation.
- ๐ Demonstrates the importance of multiple performance metrics.
- ๐ฌ Identifies opportunities for further research in healthcare AI.
| Research Area | Potential Contribution |
|---|---|
| ๐ฅ Healthcare AI | Predictive modeling research |
| ๐ซ Cardiovascular Research | Risk classification studies |
| ๐ค Machine Learning | Comparative algorithm evaluation |
| ๐ Medical Data Science | Data preprocessing and analysis |
| ๐ Explainable AI | Interpretable predictive systems |
If you use, discuss, or reference this research in your academic work, please cite the original manuscript.
Title: A Comparative Machine Learning Framework for Heart Attack Risk Prediction Using Data Preprocessing, Class Imbalance Handling, and Cross-Validation.
Authors: Shahid Azam and Dr. Adnan Amin.
Year: 2026.
@article{azam2026heartattack,
title={A Comparative Machine Learning Framework for Heart Attack Risk Prediction Using Data Preprocessing, Class Imbalance Handling, and Cross-Validation},
author={Azam, Shahid and Amin, Adnan},
year={2026}
}The following roadmap highlights potential directions for extending the current research framework.
- ๐ฌ Validate models using independent healthcare datasets.
- ๐ง Integrate Explainable Artificial Intelligence (XAI).
- ๐ Apply SHAP for feature importance analysis.
- โก Investigate advanced ensemble learning techniques.
- ๐ Explore feature selection optimization.
- ๐ฉบ Investigate additional cardiovascular risk indicators.
- ๐ Improve model calibration and threshold selection.
- ๐ Develop an interactive research demonstration.
Thank you for exploring my research repository!
I am Shahid Azam, a Computer Science researcher specializing in Artificial Intelligence.
My academic and research interests include Machine Learning, Deep Learning, Artificial Intelligence, Natural Language Processing, Healthcare Analytics, and Intelligent Predictive Systems.
I welcome opportunities for academic collaboration, research discussions, and professional networking.
Artificial Intelligence ยท Machine Learning ยท Deep Learning ยท Healthcare AI ยท Predictive Modeling ยท Explainable AI ยท Natural Language Processing ยท Large Language Models
Contributions, suggestions, and constructive feedback are welcome!
This repository aims to support academic knowledge sharing and further research in machine learning and healthcare prediction.
- ๐ด Fork this repository.
- ๐ฅ Clone your fork.
- ๐ฟ Create a new branch.
- โ๏ธ Make your proposed improvements.
- ๐ค Submit a Pull Request.
| Area | Possible Contributions |
|---|---|
| ๐ Research | Relevant academic publications |
| ๐ค Machine Learning | Additional classification algorithms |
| โ๏ธ Class Balancing | Advanced imbalance-handling methods |
| ๐ Explainability | SHAP and other XAI techniques |
| ๐ Evaluation | Additional performance metrics |
| ๐ Documentation | Corrections and improvements |
Data โข Intelligence โข Prediction โข Research Innovation
Research conducted by Shahid Azam and collaborators
ยฉ 2026 | Academic Research Project
Develop more reliable, interpretable, and generalizable machine learning approaches for healthcare risk prediction.
These items represent potential future research activities, not completed project features.
This project is intended exclusively for academic, educational, and research purposes.
The machine learning models presented in this study are experimental predictive models and are not intended to replace professional medical diagnosis, clinical judgment, or validated clinical decision-support systems.
The reported results are specific to the dataset and experimental methodology used in this research. Independent clinical validation is necessary before considering any real-world healthcare application.
This repository contains academic research materials, a research manuscript, dataset, and supporting notebook.
No formal license is currently specified for the research materials.
Please contact the author(s) for permission before redistributing or modifying the manuscript or other materials. Any third-party dataset remains subject to its original terms of use.
If you find this research useful for your academic studies, research activities, or professional interests:
- โญ Star this repository.
- ๐ Share the research with your academic network.
- ๐ Read and explore the publication on ResearchGate.
- ๐ฌ Provide constructive feedback and suggestions.
Your support and academic engagement are appreciated!