Explainable AI на собеседовании Data Scientist
Карьерник — Duolingo для аналитиков: 10 минут в день тренируй SQL, Python, A/B, статистику, метрики и ещё 3 темы собеса. 1500+ вопросов в Telegram-боте. Бесплатно.
Содержание:
Зачем XAI
Trust. Users / regulators understand model.
Debugging. Why wrong prediction?
Compliance. GDPR right к explanation. Financial regulators require.
Improvement. Find biased features.
Global vs local
Global. Overall model behavior. «Income most important feature».
Local. Specific prediction. «This customer rejected because of low credit score».
SHAP
SHapley Additive exPlanations. Game-theoretic feature attribution.
Each feature's contribution к specific prediction.
import shap
explainer = shap.TreeExplainer(model)
shap_values = explainer.shap_values(X)
shap.summary_plot(shap_values, X)Pros:
- Theoretically grounded.
- Both global и local.
- Tree-specific fast version (TreeSHAP).
Cons: computation expensive on huge data.
LIME
Local Interpretable Model-agnostic Explanations.
Approximate model locally с simple linear model.
from lime import lime_tabular
explainer = lime_tabular.LimeTabularExplainer(X_train)
exp = explainer.explain_instance(x, model.predict_proba)Pros: model-agnostic, intuitive.
Cons: local linear approx may не reflect true behavior.
Counterfactuals
«What minimal change would alter prediction?»
Customer rejected. Counterfactual:
"Если income increased on $5000, would be approved."Actionable explanations. Better для users чем feature importance.
Tools: DiCE, Alibi.
Связанные темы
- SHAP и interpretability для DS
- Permutation importance для DS
- Bias и fairness для DS
- Model card для DS
- Подготовка к собесу Data Scientist
FAQ
Это официальная информация?
Нет. Статья основана на работах Lundberg 2017 (SHAP), Ribeiro 2016 (LIME).
Тренируйте Data Science — откройте тренажёр с 1500+ вопросами для собесов.