This project uses a Support Vector Machine (SVM) classifier to predict whether a patient has diabetes based on the Pima Indians Diabetes Dataset.
The project follows a complete machine learning pipeline, including data preprocessing, feature scaling, hyperparameter tuning using GridSearchCV, ROC Curve analysis, and model evaluation.
- Dataset: Pima Indians Diabetes Database
- Target Variable: Outcome
- 0: Non-Diabetic
- 1: Diabetic
Features include:
- Pregnancies
- Glucose
- BloodPressure
- SkinThickness
- Insulin
- BMI
- DiabetesPedigreeFunction
- Age
- Python
- NumPy
- Pandas
- Matplotlib
- Seaborn
- Scikit-learn
- Jupyter Notebook
- Load the dataset
- Exploratory Data Analysis (EDA)
- Data cleaning
- Train-Test Split
- Feature Scaling using StandardScaler
- Train a Support Vector Machine (SVM)
- Hyperparameter tuning using GridSearchCV
- Model evaluation
- ROC Curve and AUC Score
- Accuracy: 73.4%
- Kernel: Linear
- C: 1
- Best Cross-Validation Score: 78.0%
- Confusion Matrix
- Classification Report
- ROC Curve
- AUC Score
| Model | Accuracy |
|---|---|
| K-Nearest Neighbors | 79.2% |
| Decision Tree | 78.6% |
| Random Forest | 76.0% |
| SVM (Default RBF) | 73.4% |
| Logistic Regression | 70.8% |
Although GridSearchCV selected a linear SVM as the best model based on cross-validation, the default RBF kernel achieved better performance on the test dataset. This highlights the importance of evaluating models using both cross-validation and an independent test set.
Through this project, I learned how to:
- Train a Support Vector Machine classifier
- Apply feature scaling using StandardScaler
- Understand the role of kernels in SVM
- Tune hyperparameters using GridSearchCV
- Evaluate a classifier using Accuracy, Precision, Recall and F1-score
- Build and interpret ROC Curves
- Calculate the AUC Score
- Compare multiple machine learning algorithms
Project_05_Diabetes/
│
├── diabetes_svm.ipynb
├── diabetes.csv
├── README.md
├── requirements.txt
└── .gitignore
Taha Lazar