7 routes42 sections324 units

Unit 5.8 · about 3 h

167 / 324

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.

  • measure

You can now

  • 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 limits
  • Partial dependence and noncausal interpretation boundaries

Study, in this order

2 steps

  1. Permutation feature importance
    scikit-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)

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

  2. Partial dependence and ICE plots
    scikit-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)

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

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.

Reproduce closed-book

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.

Traps

  • 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 \(X\) raises \(Y\). 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.

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.

Self-test

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

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

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

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

Completion criterion

Stop 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.

Mark passed, then open 5.9 Only mark this when you can do it without notes.

Leads to

Comes after

Resources for this unit

  • scikit-learn - model selection and evaluation route
    scikit-learnprimarycourse
    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 testing
    James, Witten, Hastie, Tibshirani and Taylorrequiredtheory
    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 Investigation
    Roadmap-Finalreferenceassessment
    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 Shift
    D2L authorssupporttheory
    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 problems
    Deep-MLoptionalpractice
    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 tutorials
    SciPy developersreferencereference
    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 Classification
    JMLRreferencereference
    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.

Quick find

Search Michi

Type to search every route, section, unit, topic and resource.

Enter opens the first result Esc closes

Reference

Keyboard shortcuts

n
Continue to the first unit not passed
j / k
Next / previous unit
1 2 3
Toggle learned, practised, passed
/
Open search
?
Show this help
Esc
Close open panels