Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛡️ Diabetes Prediction using Support Vector Machine (SVM)

📌 Project Overview

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

  • Dataset: Pima Indians Diabetes Database
  • Target Variable: Outcome
    • 0: Non-Diabetic
    • 1: Diabetic

Features include:

  • Pregnancies
  • Glucose
  • BloodPressure
  • SkinThickness
  • Insulin
  • BMI
  • DiabetesPedigreeFunction
  • Age

🛠️ Technologies Used

  • Python
  • NumPy
  • Pandas
  • Matplotlib
  • Seaborn
  • Scikit-learn
  • Jupyter Notebook

📊 Project Workflow

  • 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

📈 Results

Default SVM (RBF Kernel)

  • Accuracy: 73.4%

Best Model (GridSearchCV)

  • Kernel: Linear
  • C: 1
  • Best Cross-Validation Score: 78.0%
  • Confusion Matrix
  • Classification Report
  • ROC Curve
  • AUC Score

📊 Model Comparison

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.


🚀 Key Learning Outcomes

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 Structure

Project_05_Diabetes/
│
├── diabetes_svm.ipynb
├── diabetes.csv
├── README.md
├── requirements.txt
└── .gitignore

👨‍💻 Author

Taha Lazar

About

Diabetes prediction using Support Vector Machine (SVM) with feature scaling, hyperparameter tuning using GridSearchCV, ROC Curve, AUC analysis, and model evaluation using Python and Scikit-learn.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages