This project aims to predict whether a patient has diabetes using the Pima Indians Diabetes Dataset and the K-Nearest Neighbors (KNN) classification algorithm.
The project covers the complete machine learning workflow, from data preprocessing to model evaluation.
- Dataset: Pima Indians Diabetes Dataset
- Source: Kaggle / UCI Machine Learning Repository
- Pregnancies
- Glucose
- BloodPressure
- SkinThickness
- Insulin
- BMI
- DiabetesPedigreeFunction
- Age
- 0: Non-Diabetic
- 1: Diabetic
- Python
- Pandas
- NumPy
- Matplotlib
- Seaborn
- Scikit-learn
- Data Loading
- Data Exploration
- Data Cleaning
- Train/Test Split
- Feature Scaling using StandardScaler
- KNN Model Training
- Hyperparameter Tuning (Best K Selection)
- Model Evaluation
- Accuracy
- Confusion Matrix
- Classification Report
Best K value:
K = 17
Model Performance:
| Metric | Score |
|---|---|
| Accuracy | 77% |
| Precision (Diabetic) | 72% |
| Recall (Diabetic) | 56% |
| F1-Score (Diabetic) | 63% |
During this project I learned how to:
- Build a classification model using KNN.
- Split data into training and testing sets.
- Standardize numerical features.
- Tune hyperparameters.
- Evaluate a classification model using:
- Accuracy
- Precision
- Recall
- F1-score
- Confusion Matrix
- Try Decision Tree Classifier.
- Compare multiple classification algorithms.
- Improve recall for diabetic patients.
- Deploy the model using Streamlit.
Taha Lazar