Skip to content

PranavKaja/heart-disease

Repository files navigation

Heart Disease Prediction

Five classifiers compared on the 13-feature clinical heart dataset, with the strongest packaged as a Flask app that scores risk from a form.

Result: Random Forest was the strongest at ~82% accuracy; a majority-vote ensemble landed just behind at ~82%. Stack: Python, scikit-learn, Flask, pandas, matplotlib/seaborn Live case study: https://pranavkaja.vercel.app/projects/heart-disease-prediction

The problem

Predict heart-disease risk from 13 standard clinical inputs, and make it usable, not just a number in a notebook.

Approach

  • Compared five classifiers on the same train/test split: Random Forest, KNN, SVM, Decision Tree, and Logistic Regression.
  • For each, also ran Bagging and AdaBoost variants to see whether ensembling moved the needle.
  • Combined the strongest base models by majority vote.
  • Served the result as a Flask app that scores risk from a 13-field form.

Results

From the notebook (HeartDiseasePrediction.ipynb), on a 25% held-out test set:

Model Accuracy
Random Forest 82.2%
Majority-vote ensemble 81.9%
KNN 75.7%
SVM 73.9%
Decision Tree 73.0%
Logistic Regression 70.1%

Random Forest was the most reliable single model. Bagging and AdaBoost variants didn't beat it, and a majority-vote ensemble (Random Forest + Decision Tree + KNN) tracked it closely. The deployed Flask app uses that three-model majority vote.

Run it

git clone https://github.com/PranavKaja/heart-disease.git
cd heart-disease
pip install -r requirements.txt

python train.py    # trains the models and writes the .pkl files
python app.py      # then open http://localhost:5000

The full comparison, plots, and analysis live in HeartDiseasePrediction.ipynb.

Notes

Public UCI-style heart dataset (Heart.csv), 13 clinical features, no private patient data. The target column is AHD. The .pkl model files are generated by train.py, so they aren't checked in.


Part of my portfolio. Built by Pranav Kaja.

About

Heart disease risk prediction: five-model comparison, ~82% accuracy (Random Forest), served as a Flask app.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors