Feature importance, SHAP, and LIME
A prediction is only useful if you can explain why. Learn to open the black box and show stakeholders what drove each decision.
Before We Begin
Imagine a doctor receives a diagnosis from an AI and asks "why?" If the model cannot answer, the doctor cannot trust it. Interpretability is the practice of making predictions explainable. We start with simple tools—feature importance from trees and linear coefficients—then level up to SHAP values, which assign each feature a fair share of the prediction, and LIME, which builds a tiny local explanation around any single prediction.
How this lesson fits
A model that works is not enough—it also has to be understandable, fair, and ready for the real world. This module covers the human side of AI: explaining predictions, confronting bias, and deploying models responsibly.
The big question
How do we make sure an AI system is not just accurate but also transparent, fair, and safe to deploy?
Why You Should Care
Regulations like the EU AI Act increasingly require explanations for automated decisions. Beyond compliance, interpretability helps practitioners catch bugs, discover shortcuts the model learned, and build trust with non-technical stakeholders. A model you cannot explain is a model you cannot safely deploy.
Where this is used today
Think of it like this
Think of a judge writing an opinion. They don't just say "guilty"—they explain which evidence led to the verdict and how much each piece mattered. SHAP and LIME are the written opinion for your model's decisions.
Easy mistake to make
Interpretability does not mean the model is simple. Even complex deep learning models can be explained post-hoc with tools like SHAP—the explanation method is separate from the model's complexity.
Think about this first
A bank's model rejects your loan application. You ask "why?" and the bank says "the algorithm decided." Is that acceptable? What would you want to know?
Words we will keep using
A doctor receives a diagnosis from an AI and asks "why?" If the model cannot answer, the doctor cannot trust it. Interpretability is the practice of making predictions explainable \u2014 not just accurate.
Across all loan applications, which features drive the model's decisions the most? This is the bird's-eye view.
Select an applicant to see how each feature contributed to their specific prediction. Positive bars push toward approval; negative bars push toward denial. The waterfall shows how we get from the base value to the final score.
Prediction: DENIED (score: 31.7, threshold: 45)
Income: $34272/mo
Credit Score: 502
Debt Ratio: 47%
Actual: Denied
Based on game theory. Assigns each feature a fair share of the prediction, ensuring consistency and additivity.
Pros: Theoretically grounded, additive, consistent.
Cons: Can be slow for large models.
Perturbs the input slightly and fits a simple linear model around the neighborhood to explain one prediction.
Pros: Fast, model-agnostic, intuitive.
Cons: Can be unstable \u2014 different perturbations may give different explanations.
Sometimes the best explanation is a simple model. In high-stakes domains (healthcare, criminal justice, finance), a transparent decision tree or linear model that stakeholders can read directly may be preferable to a slightly more accurate but opaque neural network.