Cleaned records
—Clinical datasetCLINICAL MACHINE LEARNING
Heart disease
prediction study
Compare five classifiers trained on clinical data, see which features influenced the model, and test a fictional case in your browser.
Models compared
—Stratified five-fold tuningBest test accuracy
—Logistic regressionBest test ROC-AUC
—Logistic regression and SVMPERFORMANCE
Model comparison
Accuracy on 61 held-out records
EXPLAINABILITY
Top model factors
Mean absolute SHAP values
Research and education only. Scores describe how the model classifies a case and cannot diagnose heart disease or estimate your future risk.
STUDY RESULTS
Research results
Explore test performance, cross-validation, the dataset, and SHAP explanations for the selected model.
Held-out test performance
Five classifiers, evaluated using the same 61 records.
| Model | Accuracy | Precision | Recall | F1 | ROC-AUC |
|---|---|---|---|---|---|
| Loading results… | |||||
ROC comparison
True positive rate versus false positive rate.
Confusion matrix
Counts on the held-out test split.
Stratified five-fold validation
Accuracy during tuning on the training split. The spread is the standard deviation across folds.
| Model | Mean | Spread | Fold 1 | Fold 2 | Fold 3 | Fold 4 | Fold 5 |
|---|
Best hyperparameters
Global SHAP importance
Mean absolute impact on the positive-label log-odds across 50 test records.
SHAP dependence
Average signed impact by range for the top numeric feature. Each range groups at least five records.
SHAP explains the model's behavior. Use a fictional case to see how your inputs change its score.
Open prediction labSHAP summary
Magnitude shows typical strength. The signed mean shows the average direction relative to the training background.
| Encoded feature | Mean absolute impact | Mean signed impact |
|---|
Label distribution
Rows retained after duplicate removal.
Data checks
Preparation before preprocessing and training.
Labels by feature group
Groups display when both label counts are at least five.
Numeric screening
Range checks follow the study. IQR outliers were counted and kept.
Feature correlation
Pearson correlation on the original numeric codes. Interpret correlations for categorical codes with care.
How the experiment worked
- Prepare the data. Normalize column names, check missing values, and remove the duplicate record. Keep the binary labels as provided in the project CSV.
- Split the data. Use a stratified 80/20 split with random seed 42. Fit preprocessing and models using training records and their cross-validation folds.
- Train and tune. Standardize five numeric features and one-hot encode eight categorical features. Compare defaults with a grid search that ranks candidates by mean accuracy across five stratified folds.
- Evaluate. Report accuracy, precision, recall, F1 and ROC-AUC on the same 61 held-out records. Logistic regression led test accuracy and shared the best ROC-AUC with the support vector machine.
- Explain. Use independent-background Linear SHAP with 50 sampled training records as the reference and 50 sampled test records for the global summaries.
How to read the results
Accuracy is the share of correct classifications. Precision is the share of positive predictions that were correct. Recall is the share of positive labels the model found. F1 balances precision and recall. ROC-AUC measures how well scores rank the two classes over different thresholds.
Limitations
The study used one small dataset and one held-out split. Ranking models by that split can make the winner's reported performance optimistic. External validation, calibration, and subgroup fairness were outside the study. Some category definitions in the working CSV are undocumented, so the demo displays those values as dataset codes.
Dataset reference
The project uses its original 303-row heart.csv. UCI documents the related Cleveland Heart Disease dataset; the exact recoding and provenance of the working CSV were unverified.
PREDICTION LAB
Test a fictional case
Try the study's logistic regression model with example inputs. Scores and explanations are computed on your device.
Case inputs
Use fictional values. All 13 fields are required.
HEART GUIDE
Ask about heart health
Ask about model factors, scores, or general guidance on food, activity, and prevention.
Heart Health Assistant
A browser-based guide built from curated answers.