How dummycodertech/xai-xgboost-heart_stroke works
Clinical Stroke Predictor is a Streamlit triage application backed by an XGBoost model trained for imbalanced stroke data. The main workflow runs from patient-entered features through preprocessing, probability scoring and a configurable clinical threshold to a risk result and local SHAP explanation. The app also presents global SHAP insights, LIME explanations for selected edge cases, and model metrics. Training and explanation artifacts are prepared by separate scripts. Relationships are shown where excerpts or README statements support them; unsampled implementation details are not inferred.
Main entry points: app.py Streamlit triage app · data Processed splits · xgboost_model.pkl Trained model · data_loader.py Preprocessing
Components 17
Data preparation
- Stroke dataset
data/healthcare-dataset-stroke-data.csv - Preprocessing
data_loader.py - Processed splits
data - Fitted preprocessor
models/preprocessor.pkl
Model training
- XGBoost training
model_trainer.py - Trained model
models/xgboost_model.pkl - Evaluation metrics
models/training_metadata.json
Model analysis
- SHAP analysis
shap_explainer.py - SHAP artifacts
models/shap_values_test.pkl - Edge-case detection
edgecasedec.py - Edge-case records
models/edge_cases.json - LIME setup
lime_expl.py - LIME explainer
models/lime_explainer.pkl
Triage application
- Streamlit triage app
app.py - Risk and explanations
app.py - Insights and metrics
app.py
Other components
- Patient or user
Connections 31
- Patient or user → Streamlit triage app: enters features
app.py - Stroke dataset → Preprocessing: loads data
data_loader.py - Preprocessing → Processed splits: writes splits
data_loader.py - Preprocessing → Fitted preprocessor: saves fitted transform
data_loader.py - Processed splits → XGBoost training: loads splits
model_trainer.py - XGBoost training → Trained model: saves model
model_trainer.py - XGBoost training → Evaluation metrics: saves metrics
model_trainer.py - Trained model → SHAP analysis: loads model
shap_explainer.py - Processed splits → SHAP analysis: loads test split
shap_explainer.py - SHAP analysis → SHAP artifacts: saves values
shap_explainer.py - Trained model → Edge-case detection: loads model
edgecasedec.py - Processed splits → Edge-case detection: loads test split
edgecasedec.py - Edge-case detection → Edge-case records: saves cases
edgecasedec.py - Processed splits → LIME setup: loads training split
lime_expl.py - LIME setup → LIME explainer: saves explainer
lime_expl.py - Streamlit triage app → Fitted preprocessor: loads transform
app.py - Streamlit triage app → Trained model: loads model
app.py - Streamlit triage app → Evaluation metrics: loads metrics
app.py - Streamlit triage app → Processed splits: loads test split
app.py - Streamlit triage app → SHAP artifacts: loads global values
app.py - Streamlit triage app → LIME explainer: loads explainer
app.py - Streamlit triage app → Edge-case records: loads cases
app.py - Streamlit triage app → Risk and explanations: renders prediction
app.py - Streamlit triage app → Insights and metrics: renders insights
app.py - Fitted preprocessor → Risk and explanations: transforms input
app.py - Trained model → Risk and explanations: scores features
app.py - SHAP artifacts → Insights and metrics: drives global plots
app.py - Evaluation metrics → Insights and metrics: supplies metrics
app.py - Edge-case records → Insights and metrics: selects cases
app.py - LIME explainer → Insights and metrics: explains selected case
app.py - Risk and explanations → Streamlit triage app: renders local SHAP
app.py