Interpretable Machine Learning for Clinical Prediction
What makes a clinical model worth trusting: fewer features, honest validation, and explanations a clinician can check.
A model that predicts well but cannot be questioned rarely gets used near a patient. In clinical work, interpretability is not a report you add at the end. It is a design constraint you accept at the start, and it changes which model you build.
Start with fewer features
High-dimensional health data tempts you to keep everything. Resist it. A classifier that depends on tens of features can be inspected, re-measured and argued about; one that depends on a hundred thousand cannot. In my glioma methylation study the final classifier uses 70 CpG sites, selected from roughly 404,000 probes. That reduction is the point: it turns a black box into a short list a biologist can read.
Keep every learning step inside the training data
Most over-optimistic clinical models share one flaw: something was learned from the test data. Filtering by variance, scaling, selecting features and tuning hyperparameters all learn, so all of them belong inside the training folds. The simplest way to enforce that is to make them part of one pipeline.
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.feature_selection import SelectKBest, f_classif
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import cross_val_score
model = Pipeline([
("scale", StandardScaler()),
("select", SelectKBest(f_classif, k=70)),
("clf", LogisticRegression(max_iter=1000)),
])
# Selection is refitted inside each fold, so the held-out
# fold never influences which features are kept.
scores = cross_val_score(model, X, y, cv=5)
If the unit of observation repeats, for example several visits per patient, split by patient rather than by row. Otherwise the model is scored on people it has already seen.
Explain at two levels
- Globally: which features drive the model overall. Permutation importance and SHAP summaries both answer this.
- Locally: why the model gave this patient this prediction.
Two cautions. Attribution methods explain the model, not the biology, so a high-importance feature is a hypothesis rather than a mechanism. And correlated features share credit, which means importance can look diluted across a group that is, together, decisive.
Validate where the model will be used
Internal cross-validation tells you the pipeline is sound. It does not tell you the model travels. Test on cohorts the model never saw, ideally from another site or platform, and report uncertainty with the estimate: an accuracy with its confidence interval says far more than a single number. Check calibration as well as discrimination, because a clinician acts on the predicted probability, not on the ranking.
A short checklist
- Can the final feature list fit on one page?
- Was every data-dependent step fitted on training data only?
- Is the split made at the level of the patient?
- Is there an external cohort, and are intervals reported?
- Could a clinician say what would change the prediction?