Explain ML predictions on omics data with SHAP, LIME, and permutation importance, while respecting the boundaries that make attributions trustworthy: an attribution describes the model, not biology; the conditional-vs-interventional Shapley choice changes which correlated genes get credit; and a SHAP ranking is a debugging and hypothesis tool, never a validated biomarker panel.
pip install shap lime scikit-learn xgboost pandas
Conceptual prerequisites: a model that already generalizes (interpreting an over-fit or batch-confounded model explains an artifact), a representative background dataset for interventional SHAP, and a co-expression module map for aggregating attributions over correlated genes.
Tell your AI agent what you want to do: - "Explain my classifier with interventional SHAP and a representative background" - "Use SHAP to check whether my model is keying on batch instead of biology" - "Aggregate SHAP over co-expression modules before ranking genes" - "Explain one prediction locally, clearly labeled as model-internal"
"Which genes is my random forest actually keying on? Use interventional SHAP with a background, not the path-dependent default, and tell me the estimand."
"I want a descriptive view of which genes are informative here. Use path-dependent SHAP and explain why it is not the same as model reliance."
"Use SHAP to check whether my classifier's top features are batch indicators or housekeeping genes tracking sequencing depth."
"My top SHAP genes are co-expressed. Aggregate the attributions over co-expression modules so I do not over-interpret the within-module order."
"Explain why the model predicted disease for sample 12 with a SHAP waterfall, and note it is background-relative and model-internal."
feature_perturbation='auto' (shap 0.47+) silently flips the estimand on whether you pass data=; set it explicitly