This project implements a binary classification model using Logistic Regression to predict whether a person is diabetic or non-diabetic based on medical diagnostic measurements. The model is trained and evaluated using the Pima Indians Diabetes Dataset.
-
Binary classification using Logistic Regression
-
Uses real-world medical data (Pima Indians Diabetes Dataset)
-
Model evaluation with:
- Accuracy Score
- Confusion Matrix
- Classification Report (Precision, Recall, F1-score)
-
Visualizes confusion matrix using Seaborn heatmap
-
Predicts diabetes outcome for new patient data
Pima Indians Diabetes Dataset contains medical records of female patients and includes the following features:
- Pregnancies
- Glucose
- Blood Pressure
- Skin Thickness
- Insulin
- BMI (Body Mass Index)
- Diabetes Pedigree Function
- Age
Target Variable:
-
Outcome1→ Diabetic0→ Non-Diabetic
Dataset Source:
- UCI Machine Learning Repository (via Kaggle & GitHub)
- Dataset is loaded directly from an online CSV source.
- Features (
X) and target (y) are separated. - Data is split into training and testing sets (80% / 20%).
- Logistic Regression model is trained on the training data.
- Predictions are made on the test set.
- Model performance is evaluated using accuracy and classification metrics.
- Confusion matrix is visualized using a heatmap.
- Model predicts diabetes status for new patient data.
├── diabetes_prediction.py
├── README.md
Install the required Python libraries:
pip install pandas scikit-learn seaborn matplotlib- Clone the repository or download the script.
- Navigate to the project directory.
- Run the Python file:
python diabetes_prediction.py-
Displays the first few rows of the dataset
-
Prints:
- Accuracy percentage
- Confusion matrix
- Classification report
-
Shows a heatmap of the confusion matrix
-
Outputs predicted diabetes status for new input data
Predicted diabetes outcome for the new data: Non-Diabetic
This project is intended for educational purposes only. It should not be used for real medical diagnosis. Medical decisions should always be made by qualified healthcare professionals.
Abdullah Ali Learning Machine Learning & Data Science 🚀
⭐ If you find this project helpful, consider starring the repository!