Downloads · 30 days
0
Sathwika04/Heart_Disease_Prediction
Heart_Disease_Prediction is a machine learning model from Sathwika04. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
A machine learning web app that predicts heart disease risk using patient health data. Built with Streamlit for the interface and scikit-learn for the models.
Downloads · 30 days
0
Access
Public
Updated Jul 20, 2026
Repo size
32.3 MB
Likes
0
Public
Click a slice to open those files.
.csv32.3 MB · 100%
From the Hugging Face model README
A machine learning web app that predicts heart disease risk using patient health data. Built with Streamlit for the interface and scikit-learn for the models.
This project trains four different machine learning models on patient data, compares their performance, and uses the most accurate one to make predictions through an interactive web interface. Users can either:
| Model | Description |
|---|---|
| Decision Tree | Tuned with GridSearchCV over depth, split, and leaf parameters |
| Logistic Regression | Best solver selected automatically from lbfgs, liblinear, newton-cg, sag, saga |
| Support Vector Machine (SVM) | Best kernel selected automatically from linear, poly, rbf, sigmoid |
| Random Forest | Tuned with GridSearchCV, currently the best-performing model |
The app runs new input through all four models internally, and displays the final prediction from whichever model has the highest test accuracy.
.
├── app.py # Streamlit web app (3 tabs: Predict, Bulk Predict, Model Information)
├── decision.pkl # Trains the Decision Tree model
├── logistic.pkl # Trains the Logistic Regression model
├── support.pkl # Trains the SVM model
├── random.pkl # Trains the Random Forest model, scaler, and feature list
├── requirements.txt # Python dependencies
├── sample_bulk_predict.csv # Example CSV for testing the Bulk Predict tab
└── README.md
Note: The training scripts use a
.pklextension (despite being Python scripts) to match the original project naming. They are plain Python files and should be run withpython <filename>.pkl.
This project uses the Statlog Heart Disease dataset format, with the following columns:
Age, Sex, Chest pain type, BP, Cholesterol, FBS over 120, EKG results,
Max HR, Exercise angina, ST depression, Slope of ST,
Number of vessels fluro, Thallium, Heart Disease
The target column Heart Disease contains Presence / Absence labels, which are mapped to 1 / 0 during training.
The dataset file (cleaned_data.csv) is not included in this repository. Place your own copy in the project root before running the training scripts.
Clone the repository
git clone https://github.com/<your-username>/<your-repo>.git
cd <your-repo>
Install dependencies
pip install -r requirements.txt
Add your dataset
Place cleaned_data.csv in the project root.
Train the models
Run each training script once. This generates the model files (.pkl) the app needs:
python decision.pkl
python logistic.pkl
python support.pkl
python random.pkl
Run the app
streamlit run app.py
This opens the app in your browser at http://localhost:8501.
| Field | Encoding |
|---|---|
| Sex | 1 = Male, 0 = Female |
| Chest pain type | 1 = Typical Angina, 2 = Atypical Angina, 3 = Non-anginal Pain, 4 = Asymptomatic |
| FBS over 120 | 1 = True, 0 = False |
| EKG results | 0 = Normal, 1 = ST-T Wave Abnormality, 2 = Left Ventricular Hypertrophy |
| Exercise angina | 1 = Yes, 0 = No |
| Slope of ST | 1 = Upsloping, 2 = Flat, 3 = Downsloping |
| Thallium | 3 = Normal, 6 = Fixed Defect, 7 = Reversible Defect |
This app is for educational purposes only and is not a substitute for professional medical advice, diagnosis, or treatment. Always consult a qualified healthcare provider regarding any medical condition.