Description
Model interpretation: permutation importance, partial dependence plots, SHAP values, correlated feature handling.
Feature importance tells you which inputs drive your model's predictions. Tree-based models give built-in importance, but it can be misleading (favors high-cardinality features, biased toward the training set). Permutation importance is model-agnostic and more reliable. METHOD — PERMUTATION IMPORTANCE 1. Compute baseline metric (accuracy, AUC, RMSE) on validation set. 2. For each feature: randomly shuffle its values (destroying the relationship with the target), recompute the metric, record the drop. 3. The drop in performance = the feature's importance. Larger drop = more important feature. ADVANTAGES OVER BUILT-IN IMPORTANCE: - Model-agnostic: works for any model (neural net, XGBoost, linear regression). - Detects interactions: shuffling one feature breaks all its interactions with others. - Not biased by feature cardinality: high-cardinality features don't get inflated importance. - Interpretable units: "shuffling feature X reduces accuracy by 5 points" is intuitive. PITFALLS: - Correlated features: if two features are highly correlated, shuffling one barely hurts (the other still carries the information). Solution: group correlated features and permute them together. - Negative importance: if shuffling a feature improves performance, the model learned a spurious correlation from that feature. Remove it. - Computation cost: requires N_permutations × N_features model evaluations. For 100 features × 10 permutations = 1000 evaluations. Use a small validation set (1000 samples) to keep it fast. PARTIAL DEPENDENCE PLOTS (PDP) Feature importance tells you which features matter. PDP tells you how. For a feature X, compute the average prediction across all values of X. Plot: X-axis = feature values, Y-axis = average prediction. Flat line = no effect. Steep slope = strong effect. SHAP VALUES — LOCAL INTERPRETATION Feature importance is global (which features matter overall). SHAP is local (for this specific prediction, which features mattered most). SHAP decomposes a prediction into base value + feature contributions that sum to the prediction. Plot: horizontal bar chart with features sorted by |SHAP value|, colored by feature value (red = high, blue = low). OUTPUT: Permutation importance table (feature, importance score, std, p-value), PDP for top 5 features, SHAP summary plot for 3 representative predictions, group permutation for correlated features.
No comments yet. Be the first!