This project develops a scalable machine learning pipeline using PySpark to predict the likelihood of stroke occurrence based on patient demographic and clinical information.
The project demonstrates the complete machine learning workflow, including data preprocessing, feature engineering, dimensionality reduction, and model development using Logistic Regression. PySpark was used to efficiently process healthcare data and prepare it for predictive modeling.
- Analyze healthcare data using PySpark.
- Clean and preprocess the dataset.
- Convert data into appropriate formats for machine learning.
- Perform feature engineering and dimensionality reduction.
- Build a Logistic Regression model for stroke prediction.
- Evaluate the effectiveness of the prediction model.
This project uses the Stroke Prediction Dataset from Kaggle.
- Total Records: 5,110
- Features: 12
- Target Variable: Stroke
| Feature | Description |
|---|---|
| gender | Patient gender |
| age | Age |
| hypertension | Hypertension status |
| heart_disease | Heart disease status |
| ever_married | Marital status |
| work_type | Employment type |
| Residence_type | Urban/Rural |
| avg_glucose_level | Average glucose level |
| bmi | Body Mass Index |
| smoking_status | Smoking history |
| stroke | Target variable (0 = No Stroke, 1 = Stroke) |
Dataset Source
https://www.kaggle.com/datasets/fedesoriano/stroke-prediction-dataset
- Python
- PySpark
- Apache Spark
- Pandas
- NumPy
- Scikit-learn
- Matplotlib
- Seaborn
```text
stroke-prediction-using-pyspark/
β
βββ README.md
βββ requirements.txt
βββ .gitignore
β
βββ data/
β βββ healthcare-dataset-stroke-data.csv
β βββ stroke_dataset.csv
β
βββ src/
β βββ data_preprocessing.py
β βββ datatype_changing.py
β βββ dimensionality_reduction.py
β βββ logistic_regression.py