Dozzo's picture
Initial model upload
bcef242
---
tags:
- random-forest
- stroke-prediction
- classification
- healthcare
license: mit
widget:
- text: "Patient details: Age 45, Hypertension 1, Avg_glucose_level 170, BMI 26"
datasets:
- stroke-prediction-dataset
---
# Stroke Prediction Model
# Date 2024-12-19
This model uses a Random Forest Classifier to predict the likelihood of a stroke based on patient details.
## Model Details
- **Algorithm**: Random Forest
- **Use Case**: Healthcare, Stroke Risk Prediction
- **Performance Metrics**:
- **Accuracy**: 94.70%
- **ROC-AUC Score**: 0.79
- **Classification Report**:
```
precision recall f1-score support
0 0.95 1.00 0.97 929
1 1.00 0.02 0.04 53
accuracy 0.95 982
macro avg 0.97 0.51 0.50 982
weighted avg 0.95 0.95 0.92 982
```
## How to Use
This model i created in google colab. Relavant libraries include:
## How to Use
This runs in google colab.
Import as per below:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import random
from sklearn.model_selection import GridSearchCV
from sklearn.preprocessing import StandardScaler, LabelEncoder
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score, classification_report, confusion_matrix
from sklearn.preprocessing import MinMaxScaler
# For kaggle
import os
import zipfile
# For Hugging face
# from sklearn.externals import joblib # to save the model
from huggingface_hub import notebook_login
from huggingface_hub import Repository
Download the model and load it using `joblib
Replace input_data with your data, e.g. [[45, 1, 170, 26]] # Age, Hypertension, Avg_glucose_level, BMI