Skip to content

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Š Diabetes Prediction Using SVM

πŸš€ Overview

This project implements a Support Vector Machine (SVM) classifier to predict whether a person is diabetic based on medical data. The model is trained using scikit-learn, with StandardScaler for feature scaling to improve accuracy.

πŸ“Œ Features

  • Uses Support Vector Machine (SVM) for classification
  • Standardizes input features with StandardScaler
  • Takes user input for real-time diabetes prediction
  • Outputs whether the person is diabetic or not diabetic

πŸ”§ Installation & Setup

1️⃣ Clone the Repository

git clone https://github.com/Strange0000/diabetes-prediction-svm.git
cd diabetes-prediction-svm

2️⃣ Install Dependencies

pip install -r requirements.txt

πŸ“Š Dataset

This model is trained using the Pima Indians Diabetes Dataset, which consists of the following features:

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

πŸš€ Usage

Run the Prediction Script

python predict.py

Example Input & Output

input_data = (5,166,72,19,175,25.8,0.587,51)
# Output: The person is diabetic

πŸ“Œ Model Workflow

  1. Load the dataset and preprocess it.
  2. Train an SVM Classifier with a linear kernel.
  3. Standardize input features using StandardScaler.
  4. Predict diabetes based on new user input.

πŸ“ˆ Example Code

import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn import svm

# Load dataset (ensure you have trained the model)
df = pd.read_csv('diabetes.csv')
scaler = StandardScaler()
X = scaler.fit_transform(df.drop('Outcome', axis=1))

# Train SVM Model
clf = svm.SVC(kernel='linear')
clf.fit(X, df['Outcome'])

# Sample Prediction
input_data = np.array([[5,166,72,19,175,25.8,0.587,51]])
scaled_data = scaler.transform(input_data)
result = clf.predict(scaled_data)
print('Diabetic' if result[0] == 1 else 'Not Diabetic')

πŸ› οΈ Technologies Used

  • Python 🐍
  • Scikit-Learn πŸ€–
  • NumPy πŸ”’
  • Pandas πŸ“Š
  • Matplotlib πŸ“ˆ

🀝 Contributing

Feel free to fork this project and submit pull requests!

πŸ“œ License

This project is licensed under the MIT License.

⭐ Show Your Support

If you like this project, give it a ⭐ on GitHub!

About

πŸš€ Diabetes Prediction Using SVM | A Machine Learning model that predicts whether a person is diabetic based on medical data using a Support Vector Machine (SVM) classifier. The model is trained using StandardScaler for feature scaling and provides accurate predictions. Let me know if you'd like to tweak it! πŸš€

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages