The science behind StrokeGuard

StrokeGuard is built on a transparent, reproducible machine-learning pipeline. This page explains how the model works, how well it performs, and how every prediction is made interpretable.

Published research

IEEE · ICONAT 2023

Machine Learning Approach for Estimation and Novel Design of Stroke Disease Predictions using Numerical and Categorical Features

S. K. Satapathy, A. Patel, P. Yadav, Y. Thacker, D. Vaniya, and D. Parmar. 2023 International Conference for Advancement in Technology (ICONAT), IEEE, 2023.

The peer-reviewed study this product is based on. It analyzes ~5,000 patient records and shows that elevated glucose and advancing age are among the strongest predictors of stroke — findings the live model reproduces.

Read on IEEE Xplore (DOI: 10.1109/ICONAT57137.2023.10080722)

How the model is built

Data & cleaning. The model is trained on the public Stroke Prediction Dataset. Missing BMI values are imputed with the median, and the “unknown” smoking category is kept as a real signal rather than discarded.

Only inputs that earn their place. We audited every field by how much it actually moves cross-validated ROC-AUC. Four — gender, marital status, work type and residence type — added friction while lowering accuracy (gender alone scored 0.46, worse than a coin flip), so we deleted them. The leaner six-input model is more accurate, and you answer 40% fewer questions.

Encoding & pipeline. Numeric features are standardized and smoking status is one-hot encoded inside a single scikit-learn Pipeline, so the exact same transformation is applied at training and inference — no drift.

Model selection & tuning. Logistic Regression, Random Forest, and Histogram Gradient Boosting are compared with 5-fold cross-validation on ROC-AUC, with balanced class weights for the rare-event problem. On this dataset all three land within ~0.01 AUC of each other, so the transparent Logistic Regressionis chosen and grid-tuned (C = 0.01).

Probability calibration. Balanced training inflates raw scores, so the model is Platt-calibrated: predicted probabilities are mapped to true stroke prevalence. The result is honest numbers — an average person reads ≈5%, matching the real base rate — plus an intuitive “N× the average person's risk” readout.

Native, verified inference.The trained model is exported to JSON and re-implemented in TypeScript so it runs directly in the app with no Python service. The port is verified to match scikit-learn's output to within 1e-6.

One engine, every condition

The model isn't the product — the factory is. Adding a disease is a config entry, not a rewrite: same training, calibration, exact-explanation and native-inference code for every condition. Live today:

ConditionInputsROC-AUC
Brain stroke684.2%
Type 2 diabetes478.6%

Performance (stroke)

Best modellogistic regression
ROC-AUC (held-out test)84.2%
PR-AUC (held-out test)25.4%
Sensitivity / recall (screening point)84%
Precision (screening point)11.1%
Stroke prevalence in data4.9%

ROC-AUC and PR-AUC are threshold-free. Recall/precision are reported at a screening operating point (chosen by Youden's J) that deliberately favors catching at-risk cases — so recall is high and precision is low, which is the right trade-off for a first-line screen.

Why we don't lead with “accuracy.” Only 4.9%of records are positive stroke cases. A model that always predicts “no stroke” would score about 95.1% accuracy while catching zero real cases. That is why StrokeGuard is tuned for ROC-AUC and recall instead — to actually identify at-risk people, not to chase a misleading headline number.

How explanations work

For a linear model, each feature's push on the log-odds is exactly coefficient × (your value − average value). Summed together with the baseline, these reproduce the model's output precisely — so the breakdown you see is the actual reasoning, not a post-hoc approximation. This is the closed-form Shapley decomposition for a linear model.

On the result screen, green bars are factors lowering your risk and red bars are factors raising it, sized by how much they moved the score relative to an average person.