Interpreting ML Models
Understanding model predictions is crucial for trust.
Feature Importance
Tree-based: feature_importances_ show contributions. Permutation importance: shuffle feature, measure impact.
Global vs local importance: overall vs individual predictions.
SHAP Values
SHAP explains individual predictions. tree_explainer for tree models.
shap_values = explainer.shap_values(X). shap.summary_plot shows feature impacts.
LIME
Local interpretable model-agnostic explanations. Explains individual predictions.
LimeTabularExplainer for tabular data. Provides local linear approximation.
Key Takeaways
- Feature importance shows global contributions
- SHAP provides consistent feature attributions
- LIME explains individual predictions locally