AI says no โ but why? Use LIME, SHAP values, and counterfactuals to crack open the black box and demand explanations from any AI decision!
๐ฑ The Problem
๐ฆ LIME
๐ SHAP Values
๐ Counterfactuals
๐ Badge
Why Explainability Matters
๐ฑ
The Black Box
Complex models (deep nets, random forests) make great predictions but can't explain themselves. Accuracy โ trustworthiness.
๐ฆ
LIME
Local Interpretable Model-agnostic Explanations. Perturb the input slightly and see which changes flip the output.
๐
SHAP Values
SHapley Additive exPlanations. Game theory tells us each feature's exact contribution to the final prediction.
โ๏ธ
Legal Right
EU AI Act 2024 + GDPR Article 22 give citizens a legal right to explanation for automated AI decisions.
๐ฑ
Wizzy the AI Tutor
Imagine applying for a loan and the bank's AI says "DENIED" โ with no explanation! ๐ This happens millions of times a day worldwide. The AI has 200 million parameters and no one knows why it said no. This is the black box problem. Let's crack it open!
Step 1 โ The Black Box Problem
๐ฑ AI Loan Officer
200 million parameters ยท No explanation
Loading...
โ
?
Adjust the applicant's profile:
The AI makes its decision but tells you nothing about why. Change the inputs โ can you figure out what it cares about?
๐ Decision History
Current decisionโ
Approved tests0
Denied tests0
Your guessed reasonUnknown
โ๏ธ Real Case: In 2019, Apple Card was found to give women lower credit limits than men with identical financial profiles. The bank said "the algorithm decided" โ no explanation possible.
๐ฑ
Wizzy the AI Tutor
LIME works by poking the AI! ๐ฆ It creates hundreds of slightly different versions of the input (perturbing values up and down) and asks the AI each time. Then it finds which changes flipped the decision โ those are the important features! Click "Perturb" to see LIME in action.
Step 2 โ LIME: Perturbing the Input
// Press Run LIME Analysis to start perturbation...
Perturbation results (which changes flip the decision):
๐ฆ LIME Results
Run LIME to see results
LIME creates a simple, interpretable model that approximates the black box locally โ around the specific input being explained.
๐ฑ
Wizzy the AI Tutor
SHAP values use game theory! ๐ Imagine the features as players in a team. SHAP asks: "How much did each player contribute to the win (or loss)?" Positive SHAP = pushed toward approval. Negative SHAP = pushed toward denial. Every prediction can be decomposed into feature contributions!
Step 3 โ SHAP Values: Feature Contributions
Base prediction + feature contributions = final score
Base: 0.50=โ
๐ SHAP Summary
SHAP values sum to the difference between the actual prediction and the base rate prediction.
Game Theory: SHAP is based on Shapley values from cooperative game theory. It's the only method that satisfies efficiency, symmetry, dummy, and additivity axioms.
๐ฑ
Wizzy the AI Tutor
Counterfactuals answer: "What would have to change for the AI to say YES?" ๐ This is the most human-friendly explanation โ it gives actionable advice. "If your credit score was 50 points higher, you'd be approved." Click Generate Counterfactual to find the minimum change needed!
Step 4 โ Counterfactual Explanations
โ Original Application โ DENIED
Counterfactuals find the minimum-edit version of the input that flips the decision. They give actionable, human-understandable advice.
๐ Counterfactual Paths
EU AI Act Article 86: High-risk AI systems must provide "meaningful information about the logic involved, as well as the significance and the envisaged consequences" of automated decisions.
๐ฑ
Wizzy the AI Tutor
๐ You can now explain any AI decision! You understand LIME (local perturbation), SHAP (feature attribution via game theory), and counterfactuals (minimum-edit explanations). These are the tools AI engineers use every day to make AI trustworthy!
๐ฑ
XAI Expert Badge!
You mastered Explainable AI โ LIME, SHAP, and counterfactuals!
Optional. Stays on this device only โ not sent to WhizzStep.
๐ฑ WhizzStep AI Lab
Activity completion card for
Student Name
has explored Explainable AI โ LIME, SHAP & Counterfactuals
This records completion of a browser activity only. It is not an accredited certificate or proof of mastery.
XAI Expert
SHAP Master
AI Auditor
whizzstep.in
Key Concepts Mastered
Black Box
๐ฑ The Problem
Complex models like deep nets can't explain their own decisions. High accuracy comes at the cost of interpretability.
LIME
๐ฆ Local Explanation
Perturb the input, observe output changes, fit a simple interpretable model locally. Works on any ML model โ model-agnostic.
SHAP
๐ Feature Attribution
Shapley values from game theory. Distributes the "credit" for a prediction fairly across all input features.
Counterfactual
๐ Actionable Advice
"If X was different, the decision would change." The minimum edit needed to flip the output. Human-friendly and actionable.
EU AI Act
โ๏ธ Legal Requirement
High-risk AI (loans, hiring, justice) must explain decisions. XAI is now a legal requirement in the EU, not a nice-to-have.
Trust
๐ค Why It Matters
Humans won't use AI they don't trust. Explanations build trust โ and catch bias and errors before they cause harm.
About this lab
AI-05AI Literacy and JudgementClasses 8-1015 minFoundation
Learning objective: Probe a hidden simplified model with test inputs to see how much its reasoning can, and cannot, be inferred from outputs alone.
What this simplifies: The model inside is intentionally simple; real black-box systems are far larger and harder to interpret.
Privacy: No learner input leaves the device.
Teacher prompt: Ask the class why this simulation might mislead someone who takes it too literally.
Reflect: What is one thing this activity showed you that you did not expect?