Lion Cipher Lab

Explain ML model predictions with SHAP

Why it matters

Most machine-learning models are black boxes: you feed in numbers, a prediction comes out, and nothing tells you why. That is fine until a model decides who gets a loan, which transaction is flagged as fraud, or which login is an intruder -- and then 'the computer said so' is not an answer anyone can accept. Interpretability is the discipline of making a model explain itself, and it is not a nice-to-have; it is what makes four everyday jobs possible. Debugging: when a model is wrong you cannot fix what you cannot see, and an explanation shows you the feature that misled it. Fairness: the only…

What you'll learn

Steps in this lab

  1. Why a black box needs an explanation
  2. The words you need: SHAP value and base value
  3. Install scikit-learn, shap, and matplotlib
  4. Train a simple classifier on a built-in dataset
  5. Compute SHAP values for the trained model
  6. Global explanation: which features matter overall
  7. Local explanation: why THIS one prediction
  8. The honest limits: what an explanation does and does not prove
  9. What you can now do that most people can't

Open the full interactive lab →