A Streamlit-based web application for predicting the risk of heart disease using machine learning models.
- User-Friendly Interface: Input patient data via sidebar sliders and dropdowns.
- Multiple Models: Choose between SVM, KNN, Logistic Regression, Decision Tree, or a Voting Classifier.
- Visualizations:
- Accuracy comparison across models.
- Feature correlation matrix.
- Decision Tree structure.
- Confusion matrices for individual models.
- Real-Time Prediction: Instantly assess heart disease risk (low/high) based on input data.
-
Clone the repository:
git clone https://github.com/your-username/heart-disease-prediction.git cd heart-disease-prediction -
Install dependencies:
pip install -r requirements.txt
(Create
requirements.txtwith: streamlit, scikit-learn, pandas, numpy, matplotlib, seaborn) -
Run the app:
streamlit run model.py
- Input patient information in the sidebar (e.g., age, cholesterol, blood pressure).
- Select a model from the dropdown.
- Click Predict to see the risk assessment.
- Explore visualizations for model performance and data insights.
The heart.csv file contains clinical features for heart disease prediction, including:
age,sex,cp(chest pain type),trestbps(resting blood pressure),chol(cholesterol), and more.- Preprocessing:
- Missing values and duplicates are removed.
- Features are scaled using
StandardScaler. - Lower-priority features (bottom 33% by Z-score) are excluded.
- Supported Algorithms:
- Support Vector Machine (SVM)
- K-Nearest Neighbors (KNN)
- Logistic Regression
- Decision Tree
- Voting Classifier (ensemble of all models)
- Metrics:
- Accuracy scores for each model.
- Confusion matrices to evaluate performance.
.
├── model.py # Streamlit app and ML model training
├── heart.csv # Heart disease dataset
├── README.md # Project documentation
├── AI-Project.ipynb # Jupyter Notebook file
└── requirements.txt # Dependency list