Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Stroke Prediction using Machine Learning

This project analyzes a medical dataset to predict the likelihood of a patient having a stroke using various machine learning classifiers. It includes data preprocessing, feature engineering, model training, evaluation, and comparison.

πŸ“ Dataset

The dataset used is the Stroke Prediction Dataset from Kaggle.

You can download it directly from the Kaggle link above.

πŸ“Š Features

Feature Description
id Unique identifier (dropped in preprocessing)
gender Gender of the patient
age Age of the patient
hypertension 1 if the patient has hypertension, else 0
heart_disease 1 if the patient has any heart disease, else 0
ever_married Marital status
work_type Type of work (e.g. Private, Self-employed)
Residence_type Urban or Rural
avg_glucose_level Average glucose level in blood
bmi Body Mass Index (missing values filled)
smoking_status Smoking status
stroke Target variable (1 = stroke, 0 = no stroke)

πŸ”§ Preprocessing Steps

  • Dropped id column.
  • Imputed missing values in bmi using the median.
  • Label encoded binary columns: gender, ever_married, Residence_type.
  • One-hot encoded: work_type, smoking_status.
  • Standard scaled: age, avg_glucose_level, bmi.

πŸ€– Models Implemented

  • Logistic Regression
  • SGD Classifier
  • Perceptron
  • Gaussian Naive Bayes
  • K-Nearest Neighbors (KNN)
  • Linear Support Vector Classifier (SVC)
  • Multi-Layer Perceptron (MLPClassifier)

Note: The dataset is imbalanced. SMOTE (Synthetic Minority Over-sampling Technique) was used to oversample the minority class during training.


πŸ“ˆ Evaluation Metrics

The following metrics are used to evaluate the models:

  • Accuracy
  • Precision
  • Recall
  • F1 Score
  • Mean Absolute Error (MAE)
  • Mean Squared Error (MSE)
  • Confusion Matrix
  • Classification Report

About

This project analyzes a medical dataset to predict the likelihood of a patient having a stroke using various machine learning classifiers. It includes data preprocessing, feature engineering, model training, evaluation, and comparison.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages