This is a Streamlit web application that allows users to predict the probability of diabetes based on personal health information. The app uses Logistic Regression and K-Nearest Neighbors (KNN) models and also provides exploratory data analysis (EDA) and data visualization features.
- Dataset overview with shape, missing values, and statistical summary
- Exploratory Data Analysis (EDA) with:
- Count plots
- Box plots
- KDE plots
- Correlation heatmap
- Predict diabetes using:
- Logistic Regression
- K-Nearest Neighbors (KNN)
- Enter patient information in a user-friendly interface
- View prediction probability and results
The dataset diabetes_prediction_dataset.csv contains the following columns:
gender: Gender of the patientage: Age of the patienthypertension: Hypertension status (Yes/No)heart_disease: Heart disease status (Yes/No)smoking_history: Smoking historybmi: Body Mass IndexHbA1c_level: HbA1c Levelblood_glucose_level: Blood Glucose Leveldiabetes: Diabetes outcome (0 = No, 1 = Yes)
- Clone the repository:
git clone https://github.com/your-username/diabetes-streamlit-app.git
cd diabetes-streamlit-app- Create a virtual environment (optional but recommended):
python -m venv venv
- Activate the virtual environment:
Windows:
venv\Scripts\activate
Mac/Linux:
source venv/bin/activate
Install dependencies:
pip install -r requirements.txt
Run the app:
streamlit run app.py
Open your browser and go to the local URL shown in the terminal.
Create a requirements.txt file with the following packages:
numpy pandas streamlit seaborn matplotlib scikit-learn
Optional: For exact versions (recommended for reproducibility):
pip freeze > requirements.txt
Create a .gitignore file to avoid unnecessary files:
pycache/ *.pyc .venv/ venv/ .env .DS_Store .ipynb_checkpoints/
Muhammad Umar Data Science Enthusiast & Python Developer
This project is licensed under the MIT License.