Coding Hubs School of AI – Best AI & Full Stack Courses in Delhi NCR | 100% Placement
Limited Offer: Get 50% OFF on AI & Full Stack Courses
📞 Call Now: +91 8448811540
Back to Machine Learning Notes
Topic #2206

Global vs Local Explanations

Every explainability technique answers one of two fundamentally different questions: "how does this model behave overall?" (global) or "why did the model make this one prediction?" (local) — picking the wrong scope for your actual question is a common, avoidable mistake.

The Core Distinction

Global ExplanationLocal Explanation
Question answeredWhat does the model rely on overall, across all predictions?Why did the model predict this specific outcome for this specific input?
Example question"Which features matter most for churn prediction generally?""Why was this specific customer's churn risk predicted at 85%?"
AudienceData scientists, model developers, general stakeholdersAn individual affected by a specific decision, a support agent, an auditor of one case

Which Techniques Serve Which Scope

TechniqueGlobal?Local?
Permutation ImportanceYesNo
Random Forest's built-in feature_importances_YesNo
LIMENoYes
SHAPYes (aggregated)Yes (per instance)
Linear model coefficientsYesPartially — same coefficient applies everywhere, but its contribution to a specific prediction can still be computed

A Worked Illustration of Why Scope Matters

# GLOBAL: "which features matter most for the model overall?"
from sklearn.inspection import permutation_importance
result = permutation_importance(model, X_val, y_val, n_repeats=10)
# -> one importance ranking, describing the model's OVERALL behavior

# LOCAL: "why did the model predict THIS customer will churn?"
import shap
explainer = shap.TreeExplainer(model)
shap_values = explainer.shap_values(X_val.iloc[[42]])   # just ONE row
# -> a feature-by-feature breakdown for THIS SPECIFIC prediction, which may
# look very different from the global importance ranking above

A feature can rank low in global importance (rarely influential overall) while still being the dominant factor for one specific, unusual prediction — global and local explanations genuinely can, and often do, tell different stories, and neither one is "wrong."

Choosing the Right Scope for a Real Situation

SituationRight Scope
Explaining model behavior to a technical team for debuggingGlobal
Explaining one loan denial to the specific applicantLocal
Deciding which features are safe to drop for a simpler modelGlobal
Auditing a single, unusual/flagged predictionLocal

Practical Use Cases

  • Correctly matching an explainability request (from a stakeholder, regulator, or teammate) to the right technique and scope
  • Recognizing when a global summary alone won't satisfy a request that's actually asking about one specific case

Common Mistakes

  • Answering "why did the model deny this specific application?" with a global feature importance chart — the global ranking may not reflect what actually drove this one case.
  • Assuming a locally important feature for one prediction must also be globally important overall — the two scopes can disagree, and both can be simultaneously correct.

Interview Relevance

Q: "A stakeholder asks 'why did the model deny this customer's loan?' Which explainability approach do you use?" A local explanation (SHAP for that specific instance, or LIME) — this question is about one specific prediction, not the model's overall behavior, so a global feature importance ranking would answer a different question than the one actually being asked.

Practice Question

Explain a realistic scenario where a feature ranks low in global permutation importance but has a large SHAP value for one specific prediction.

Related ML Notes

Want to go beyond the notes?

Join Coding Hubs School of AI's Machine Learning course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available
💬 Talk to Advisor
1
WhatsApp

Latest from Our Blog

Insights on AI, Data Science, Full Stack & Career

View All Articles →