Unit 8 of 10 · about 3 hours · measure

Permutation importance and partial dependence

Importance and dependence plots describe what the fitted model leans on, not what causes the outcome. Correlated features make both lie smoothly.

You'll be able to

  • Compute permutation importance on a held-out set with repeats and report importances with their spread.
  • Distrust importance and PDP readings under correlated features and check with clustered or ICE views.
  • State PDP and ICE results as model behavior on constructed points, never as causal effects.

Covers

Permutation importance and correlated-feature limitsPartial dependence and noncausal interpretation boundaries
1

Read

In this order, only the parts listed

0 of 2 done

  1. Permutation feature importancescikit-learn - model selection and evaluation route

    The diabetes Ridge worked example (s5 0.204, bmi 0.176, bp 0.088, sex 0.056 at n_repeats=30), Section 5.2.2 (impurity/MDI bias toward high-cardinality features) and Section 5.2.3 (correlated features share credit; cluster and keep one per group)

    Skip the multicollinear example figures. The breast-cancer warning paragraph carries the point.

  2. Partial dependence and ICE plotsscikit-learn - model selection and evaluation route

    Section 5.1 (PDP marginalizes over complement features; correlated inputs create absurd constructed points), Section 5.1.2 (ICE lines with kind='both' reveal hidden heterogeneity) and Section 5.1.4 (brute versus recursion can disagree under correlation)

    Stop before the multi-class dropdown. One binary or regression example is enough.

2

Focus on

  • Permutation importance is model- and score-relative: shuffle one column, measure the score drop, repeat. Importance is the reference minus the corrupted mean.
  • Compute it on held-out data with a decent model. On a bad model low importance means nothing; train versus held-out gaps flag overfit.
  • Under correlation, permutation importance splits credit across partners and PDP averages over impossible combinations. Cluster correlated features first and overlay ICE.
  • Impurity (MDI) importance favors high-cardinality and numeric features and rewards overfit. Never present it as interchangeable with permutation importance.
Common mistakes · 3
  • Dropping unimportant correlated features one at a time. Partners cover for each other, so remove the cluster or nothing.
  • Reading a PDP slope as raising raises . PDP shows model output on constructed rows with complement values borrowed from other rows; no intervention happened.
  • Quoting MDI importances as feature truth. They are computed on training splits during fitting and biased toward fine-grained splitters.
3

Try it yourself

Closed-book, before checking anything

Closed-book, run the diabetes Ridge permutation snippet (n_repeats=30, random_state=0) and recover the top-4 order with s5 near 0.204. Then plot centered ICE lines for bmi: Ridge is linear, so every line is identical. Refit HistGradientBoostingRegressor(random_state=0) on the same split and its centered ICE lines end anywhere from about 36 to 152; describe where they spread.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Permutation importance of and (correlation 0.95) is near zero for both, yet dropping both tanks the score. Explain.Answer

    The fitted model reads the same signal through both columns, so shuffling one leaves the partner carrying most of it and each drop looks small. Removing both removes the signal. Cluster correlated features and judge the cluster.

  2. 2.Why must permutation importance run on a held-out set with a decent model?Answer

    On training data it measures memorization leverage, and on a bad model the reference score is meaningless. Held-out drops measure reliance that generalizes.

  3. 3.The temperature PDP falls above 35C but some ICE lines are flat. What do you conclude?Answer

    The average hides heterogeneity: heat hurts only a subgroup, an interaction. Report the ICE spread, not just the PD line.

  4. 4.MDI ranks a 1000-level id column first while permutation ranks it near zero with large spread. Which do you trust?Answer

    Permutation on held-out data. MDI is biased to high-cardinality splitters and computed in-sample: the id memorizes but does not generalize.

5

Practice

  • scikit-learn permutation importance titanic check

    Reproduce the RandomForest titanic result: random_cat and random_num sit near zero importance while real features stand out, with spread over repeats

    Then repeat the diabetes snippet locally and confirm s5 at 0.204 +/- 0.050 before trusting your own run.

You're done when

Your permutation ranking matches the docs' diabetes order, and you can show one correlated-feature trap and one PDP-heterogeneity trap on your own model.

Only when you can do this without notes.

Leads to

Notes

Resources · 1 for this unit, 6 more in the section
  • scikit-learn - model selection and evaluation routescikit-learn · primary

    Follow Cross-validation, Hyperparameter tuning, Decision threshold tuning, Metrics and scoring, Probability calibration, Validation curves, Permutation importance and Common Pitfalls. Retain raw predictions and independently hand-check central metrics.

Also in this section

  • ISLP - resampling and multiple testingJames, Witten, Hastie, Tibshirani and Taylor · required

    Use Chapter 5 and the relevant selection-history parts of Chapter 13 with their Python labs. Connect resampling to uncertainty and multiplicity without repeating the full statistics stage.

  • Classical ML Scientific InvestigationRoadmap-Final · reference

    Use Core requirements, architecture constraints, Milestones A-F and failure injection as the standard for end-to-end evidence. The full project remains a later capstone route.

  • D2L - Environment and Distribution ShiftD2L authors · support

    Read 4.7, then construct one controlled covariate, label and concept shift. Record what changes, which signal detects it and what response the evidence supports.

  • Deep-ML candidate - evaluation problemsDeep-ML · optional

    After the platform admission check, use at most one of 18 K-Fold CV, 260 Expected Calibration Error, 276 ROC, 277 AUC or 840 Stratified K-Fold. Hand-checked local metrics remain the evidence.

  • SciPy - Resampling and Monte Carlo methods tutorialsSciPy developers · reference

    Work the notebooks linked from this page: Tutorial 3 (The Bootstrap) with scipy.stats.bootstrap, including paired=True, and Tutorial 2b (Paired-Sample Permutation Tests) with permutation_test and permutation_type='samples'. Keep one resampling index stream across compared models.

  • El-Yaniv and Wiener - On the Foundations of Noise-free Selective ClassificationJMLR · reference

    Read the Abstract and Section 2 (Preliminary Definitions: Definitions 1 and 2 for coverage and selective risk) for the risk-coverage tradeoff. Stop before the noise-free learning bounds.