Skip to content

TreeSHAP and its two games: path-dependent and interventional

TreeSHAP computes exact Shapley values for tree ensembles in polynomial time by walking the trees. Learn the two value functions it can use, why they disagree under correlation, and how to aggregate local values honestly.

Advanced ~12 min9 steps

What runs in CodeSplash

You will be able to

  • Explain how tree structure makes exact Shapley values cheap
  • Contrast path-dependent and interventional TreeSHAP value functions
  • Check additivity and aggregate local values without losing sign and heterogeneity

Read first

01

Exact, and fast, for trees

Read

KernelSHAP treats the model as a black box and samples subsets. A tree ensemble isn't a black box: each prediction follows paths of splits. TreeSHAPTreeSHAPExact Shapley values for tree ensembles, computed from their structure at little cost. uses that structure to compute exact Shapley values by tracking, along each path, how much of the prediction each feature's splits are responsible for, in time polynomial in the tree depth instead of exponential in the number of features.

f(x)=ϕ0+∑j=1dϕj(x),ϕ0=v(∅).f(x)=\phi_0+\sum_{j=1}^d\phi_j(x),\qquad \phi_0=v(\varnothing).

For boosted trees on a classification task, the values add up on the log-odds scale, not the probability scale.

Reference · EXP003 · Runs in CodeSplashTreeSHAPCompute Shapley attributions efficiently by using tree structure rather than treating every prediction as an opaque black-box query.
02

Two value functions

Read

"Exact" depends on the game. TreeSHAP comes in two versions:

  • Path-dependent. An absent feature follows each split in proportion to how many training rows went each way (the tree's stored cover). No background data is needed.
  • InterventionalInterventional TreeSHAPTreeSHAP that fills missing features from a background sample; the path-dependent version uses the tree's own training-row splits.. An absent feature takes its values from a background sample, breaking its link with the present features.

With independent features they agree. With correlated features they can rank features differently: the path-dependent version lets a feature's correlate "stand in" through the training splits; the interventional version doesn't. Neither is a causal model.

03

By hand: a two-feature tree

Read

The reference's example uses a tiny tree, f=5f=5 when both features exceed 0.5, 33 when only the first does, else 11, with a four-row background and the row (1,1)(1,1). Using background averages as the value function (the interventional game), the base value is 2.50 and the two Shapley values are 1.75 and 0.75: they add up to the prediction, 5. Checking a few tiny trees against full enumeration like this is the standard unit test for any TreeSHAP implementation.

04

TreeSHAP in CodeSplash

Read

SHAP values for a saved model uses the boosters' own TreeSHAP for XGBoost and LightGBM, the path-dependent version, on the log-odds scale.

SHAP values for a saved model — learn.xgboost/multiclass_penguinsRecorded · Python and R agreeRecorded 2026-11-25 · 17 values compared
R

Across 40 rows, flipper_len moves the model's log-odds of P(Gentoo) the most (mean |SHAP| 1.84).

Mean |SHAP|, flipper_len
1.842
Average log-odds of P(Gentoo)
0.0423

Plots

Mean |SHAP| (TreeSHAP, log-odds scale)Which features does the model rely on most?
View data
FeatureMean |SHAP|
flipper_len1.842
island0.4933
bill_dep0.2652
body_mass0.0419
bill_len0
sex0
SHAP values per row (TreeSHAP)How does each feature push individual predictions up or down, and for which values?
View data
FeatureSHAP (log-odds)Feature value (scaled)
flipper_len−1.5670.1200
flipper_len−1.5210
flipper_len−2.1090
flipper_len−2.1090.1800
flipper_len−1.3730.1600
flipper_len−1.3730.2200
flipper_len−2.1090.1200
flipper_len−2.1090.4000
flipper_len−2.1090.1200
flipper_len−2.3040.3000
flipper_len−1.3730.2600
flipper_len−1.3730.1200
flipper_len−2.1090.2600
flipper_len−2.1090.0800
flipper_len−2.1090.2600
flipper_len−1.3730.3000
flipper_len−1.3730.3400
flipper_len−1.5670.2600
flipper_len−1.5670.2000
flipper_len2.2030.5800
flipper_len2.0970.9000
flipper_len2.0970.6600
flipper_len2.0970.9000
flipper_len2.2030.6800
flipper_len2.0970.6800
flipper_len2.0970.8000
flipper_len2.0970.8200
flipper_len2.3980.8600
flipper_len2.3730.8800
flipper_len2.0970.5800
flipper_len2.0970.7200
flipper_len2.3731
flipper_len2.0970.7000
flipper_len−1.3730.4200
flipper_len−1.3730.3400
flipper_len−1.3730.0200
flipper_len−1.3730.3000
flipper_len−1.3730.4000
flipper_len−1.3730.3200
flipper_len−1.3730.4200
island−0.81771
island−0.81771
island0.17130
island0.17130
island−0.81770.5000
island−0.81770.5000
island0.17130
island0.17130
island0.17130
island0.17130
island−0.81771
island−0.81770.5000
island0.17130
island0.17130
island0.17130
island−0.81771
island−0.81771
island−0.81770.5000
island−0.81770.5000
island0.31490

First 60 of 240 rows.

SHAP dependence — flipper_lenHow does one feature's value change its contribution, and does another feature modify it?
View data
SHAP (log-odds)flipper_len
−1.567186
−1.521180
−2.109180
−2.109189
−1.373188
−1.373191
−2.109186
−2.109200
−2.109186
−2.304195
−1.373193
−1.373186
−2.109193
−2.109184
−2.109193
−1.373195
−1.373197
−1.567193
−1.567190
2.203209
2.097225
2.097213
2.097225
2.203214
2.097214
2.097220
2.097221
2.398223
2.373224
2.097209
2.097216
2.373230
2.097215
−1.373201
−1.373197
−1.373181
−1.373195
−1.373200
−1.373196
−1.373201
Why row 11 got its score (TreeSHAP, log-odds scale)Which features pushed this one prediction up, and which pulled it down?
View data
SHAP (log-odds)FeatureValue
−1.567flipper_len186
−0.8177islandTorgersen
−0.0402bill_dep17.1
−0.0174body_mass3300
0bill_len37.8
0sexmissing

Assumptions

  • Enough rows — 40 explained rows, 275 background rows.
  • Features vary independently — flipper_len and body_mass: |ρ| = 0.85; changing one alone creates unlikely rows, so read their shares as joint.
  • Rows resemble the training data — 0.0% of the explained rows fall outside the background's range.
The exact R script · R R version 4.5.1 (2025-06-13)
# SHAP values for a saved model
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method explain.shap 1.1.0 · spec 376abc834635e0a3
# Explains the saved model learn.xgboost/multiclass_penguins with its own learner code (learn.xgboost 1.2.0, driver mode "explain").
# XGBoost
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method learn.xgboost 1.2.0 · spec 5bd576edd347a4f1
# Dataset: ml_penguins (version 1)
# Runs on its own: outside the app, cs_publish() writes $CS_RESULT_PATH or prints the result JSON.

# %% Setup
library(codesplashr)
suppressPackageStartupMessages(library(xgboost))

# %% Data and split plan
TARGET <- "species"
FEATURES <- c("island", "bill_len", "bill_dep", "flipper_len", "body_mass", "sex")
TASK <- "multiclass"
CLASSES <- c("Adelie", "Chinstrap", "Gentoo")
POSITIVE <- NULL
METRIC <- "log_loss"
SEED <- 42
PARAMS <- list(
  n_estimators = 25,
  learning_rate = 0.2,
  max_depth = 3,
  min_child_weight = 1,
  subsample = 1,
  colsample_bytree = 1,
  reg_lambda = 1,
  reg_alpha = 0,
  gamma = 0,
  early_stopping = 0,
  validation_fraction = 0.1,
  scale_pos_weight = 1,
  monotone = "",
  max_bin = 256,
  threads = 1,
  survival_model = "cox",
  aft_distribution = "normal",
  aft_sigma = 1
)

df <- as.data.frame(nanoparquet::read_parquet("tests/parity/fixtures/ml_penguins.parquet", col_select = unique(c(TARGET, FEATURES))))
plan <- cs_ml_read_plan("model-r/folds.parquet")  # host-written folds: identical in Python and R
design <- cs_ml_design(
  df, FEATURES,
  kinds = list(
    island = "categorical",
    bill_len = "numeric",
    bill_dep = "numeric",
    flipper_len = "numeric",
    body_mass = "numeric",
    sex = "categorical"
  ),
  levels = list(
    island = c("Biscoe", "Dream", "Torgersen"),
    sex = c("female", "male")
  ),
  impute = "none",
  scale = "none",
  indicators = FALSE
)
target <- cs_ml_encode_target(df[[TARGET]], TASK, CLASSES, POSITIVE)
y <- target$fit
y_index <- target$index
weights <- cs_ml_class_weights(y_index, TASK, "none", plan$train)
run <- cs_ml_run(TASK, CLASSES, POSITIVE, METRIC)
out <- cs_ml_out_dir("explain-out-r")
warnings <- list()
sample_weights <- function(rows) if (is.null(weights)) NULL else weights[rows + 1L]
rows_of <- function(rows) df[rows + 1L, , drop = FALSE]

# %% Model
# Same parameters as the Python twin: the shared XGBoost core then builds identical trees.
xgb_params <- list(
  objective = switch(TASK, regression = "reg:squarederror", binary = "binary:logistic", multiclass = "multi:softprob", survival = "survival:cox"),
  eta = PARAMS$learning_rate,
  max_depth = as.integer(PARAMS$max_depth),
  min_child_weight = PARAMS$min_child_weight,
  subsample = PARAMS$subsample,
  colsample_bytree = PARAMS$colsample_bytree,
  lambda = PARAMS$reg_lambda,
  alpha = PARAMS$reg_alpha,
  gamma = PARAMS$gamma,
  max_bin = as.integer(PARAMS$max_bin),
  tree_method = "hist",
  nthread = as.integer(PARAMS$threads),
  seed = SEED,
  eval_metric = switch(TASK, regression = "rmse", binary = "logloss", multiclass = "mlogloss", survival = "cox-nloglik")
)
if (TASK == "multiclass") xgb_params$num_class <- length(CLASSES)
if (TASK == "binary") xgb_params$scale_pos_weight <- PARAMS$scale_pos_weight
# Monotone constraints by design column (numeric and true/false features only).
monotone <- cs_ml_monotone(
  PARAMS$monotone,
  cs_ml_design_names(list(design = design)),
  Filter(function(f) !identical(design$kinds[[f]], "categorical"), FEATURES)
)
warnings <- c(warnings, as.list(monotone$problems))
if (any(monotone$constraints != 0)) {
  xgb_params$monotone_constraints <- paste0("(", paste(monotone$constraints, collapse = ","), ")")
}

fit_model <- function(X, y, w) {
  rounds <- as.integer(PARAMS$n_estimators)
  if (PARAMS$early_stopping > 0 && length(y) > 2) {
    # Seeded validation slice of the training rows (same rows in Python).
    s <- cs_ml_es_split(length(y), PARAMS$validation_fraction, SEED)
    part <- function(idx) xgb.DMatrix(unname(X[idx, , drop = FALSE]), label = y[idx],
                                      weight = if (is.null(w)) NULL else w[idx], missing = NA)
    return(xgb.train(params = xgb_params, data = part(s$fit), nrounds = rounds,
                     evals = list(valid = part(s$valid)),
                     early_stopping_rounds = as.integer(PARAMS$early_stopping), verbose = 0))
  }
  dtrain <- xgb.DMatrix(unname(X), label = y, weight = w, missing = NA)
  xgb.train(params = xgb_params, data = dtrain, nrounds = rounds, verbose = 0)
}

predict_model <- function(model, X) {
  best <- xgb.attr(model, "best_iteration")  # set by early stopping (0-based), kept in model.ubj
  d <- xgb.DMatrix(unname(X), missing = NA)
  p <- if (is.null(best)) predict(model, d) else predict(model, d, iterationrange = c(1L, as.integer(best) + 1L))
  if (TASK == "multiclass" && !is.matrix(p)) p <- matrix(p, ncol = length(CLASSES), byrow = TRUE)
  p
}

feature_importance <- function(model, names) {
  imp <- xgb.importance(model = model)  # Gain = share of total gain (features f0, f1, … by position)
  idx <- as.integer(sub("^f", "", imp$Feature)) + 1L
  stats::setNames(as.list(imp$Gain), names[idx])
}

save_model <- function(model, directory) {
  path <- file.path(directory, "model.ubj")
  xgb.save(model, path)  # loads in Python and R alike
  list(list(key = "model", path = path, format = "xgboost-ubj"))
}

load_model <- function(directory) xgb.load(file.path(directory, "model.ubj"))

# %% Explain the model
REQUEST <- jsonlite::fromJSON("{\"analyze\":{\"kind\":\"shap\",\"method\":\"explain.shap\",\"model\":\"learn.xgboost/multiclass_penguins\",\"title\":\"SHAP values for a saved model\",\"version\":\"1.1.0\"},\"class\":\"Gentoo\",\"coalitions\":256,\"kernelBackground\":30,\"kernelRows\":40,\"maxRows\":40,\"methods\":[\"shap\"],\"modelDir\":\"model-r/out\",\"rows\":\"auto\",\"shapRows\":40}", simplifyVector = FALSE)
if (is.null(REQUEST)) REQUEST <- list()
model_dir <- if (is.null(REQUEST$modelDir)) out else REQUEST$modelDir
prep <- cs_ml_design_from_json(paste(readLines(file.path(model_dir, "design.json"), warn = FALSE), collapse = "\n"))
# S3 predict methods (ranger, e1071, …) need their package's namespace loaded.
for (pkg in c("xgboost")) {
  suppressWarnings(suppressPackageStartupMessages(requireNamespace(pkg, quietly = TRUE)))
}
model <- load_model(model_dir)
explainer <- cs_ml_explainer(predict_model, model, prep, TASK, CLASSES, POSITIVE, METRIC, cls = REQUEST$class)
rows <- cs_ml_explain_rows(plan, if (is.null(REQUEST$rows)) "auto" else REQUEST$rows,
                           as.integer(if (is.null(REQUEST$maxRows)) 1000 else REQUEST$maxRows), SEED)
cs_publish(cs_ml_explain(
  explainer, df, rows, plan$train, y, y_index, REQUEST, SEED, model_dir, out,
  warnings = warnings,
  title = "XGBoost",
  engine = cs_engine_info("xgboost", "nanoparquet")
))
Python

Across 40 rows, flipper_len moves the model's log-odds of P(Gentoo) the most (mean |SHAP| 1.84).

Mean |SHAP|, flipper_len
1.842
Average log-odds of P(Gentoo)
0.0423

To keep this page light, the plots are shown once, under the R tab.

Assumptions

  • Enough rows — 40 explained rows, 275 background rows.
  • Features vary independently — flipper_len and body_mass: |ρ| = 0.85; changing one alone creates unlikely rows, so read their shares as joint.
  • Rows resemble the training data — 0.0% of the explained rows fall outside the background's range.
The exact Python script · Python Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# SHAP values for a saved model
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method explain.shap 1.1.0 · spec 376abc834635e0a3
# Explains the saved model learn.xgboost/multiclass_penguins with its own learner code (learn.xgboost 1.2.0, driver mode "explain").
# XGBoost
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method learn.xgboost 1.2.0 · spec 5bd576edd347a4f1
# Dataset: ml_penguins (version 1)
# Runs on its own: outside the app, cs.publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
import os

import numpy as np
import pandas as pd

import codesplash as cs
from codesplash import ml as csml
import xgboost as xgb

from codesplash.ml import boosting as csboost

# %% Data and split plan
TARGET = "species"
FEATURES = ["island", "bill_len", "bill_dep", "flipper_len", "body_mass", "sex"]
TASK = "multiclass"
CLASSES = ["Adelie", "Chinstrap", "Gentoo"]
POSITIVE = None
METRIC = "log_loss"
SEED = 42
PARAMS = {
    "n_estimators": 25,
    "learning_rate": 0.2,
    "max_depth": 3,
    "min_child_weight": 1,
    "subsample": 1,
    "colsample_bytree": 1,
    "reg_lambda": 1,
    "reg_alpha": 0,
    "gamma": 0,
    "early_stopping": 0,
    "validation_fraction": 0.1,
    "scale_pos_weight": 1,
    "monotone": "",
    "max_bin": 256,
    "threads": 1,
    "survival_model": "cox",
    "aft_distribution": "normal",
    "aft_sigma": 1,
}

df = pd.read_parquet("tests/parity/fixtures/ml_penguins.parquet", columns=list(dict.fromkeys([TARGET] + FEATURES)))
plan = csml.read_plan("model-python/folds.parquet")  # host-written folds: identical in Python and R
design = csml.Design.for_frame(
    df,
    FEATURES,
    kinds={
        "island": "categorical",
        "bill_len": "numeric",
        "bill_dep": "numeric",
        "flipper_len": "numeric",
        "body_mass": "numeric",
        "sex": "categorical",
    },
    levels={
        "island": ["Biscoe", "Dream", "Torgersen"],
        "sex": ["female", "male"],
    },
    impute="none",
    scale="none",
    indicators=False,
)
y, y_index = csml.encode_target(df[TARGET], TASK, CLASSES, POSITIVE)
weights = csml.class_weights(y_index, TASK, "none", plan.train)
run = csml.LearnerRun(TASK, CLASSES, POSITIVE, METRIC)
out = csml.out_dir("explain-out-python")
warnings = []


def sample_weights(rows):
    return None if weights is None else weights[rows]


# %% Model
# Same parameters as the R twin: the shared XGBoost core then builds identical trees.
XGB_PARAMS = {
    "objective": {"regression": "reg:squarederror", "binary": "binary:logistic", "multiclass": "multi:softprob", "survival": "survival:cox"}[TASK],
    "eta": PARAMS["learning_rate"],
    "max_depth": int(PARAMS["max_depth"]),
    "min_child_weight": PARAMS["min_child_weight"],
    "subsample": PARAMS["subsample"],
    "colsample_bytree": PARAMS["colsample_bytree"],
    "lambda": PARAMS["reg_lambda"],
    "alpha": PARAMS["reg_alpha"],
    "gamma": PARAMS["gamma"],
    "max_bin": int(PARAMS["max_bin"]),
    "tree_method": "hist",
    "nthread": int(PARAMS["threads"]),
    "seed": SEED,
    "eval_metric": {"regression": "rmse", "binary": "logloss", "multiclass": "mlogloss", "survival": "cox-nloglik"}[TASK],
}
if TASK == "multiclass":
    XGB_PARAMS["num_class"] = len(CLASSES)
if TASK == "binary":
    XGB_PARAMS["scale_pos_weight"] = PARAMS["scale_pos_weight"]
# Monotone constraints by design column (numeric and true/false features only).
MONOTONE, problems = csboost.monotone_constraints(
    PARAMS["monotone"],
    csml.FittedDesign(design, {}, {}, {}).names,
    [f for f in FEATURES if design.kinds.get(f) != "categorical"],
)
warnings.extend(problems)
if any(MONOTONE):
    XGB_PARAMS["monotone_constraints"] = "(" + ",".join(str(c) for c in MONOTONE) + ")"


def fit_model(X, y, w):
    rounds = int(PARAMS["n_estimators"])
    if PARAMS["early_stopping"] > 0 and len(y) > 2:
        # Seeded validation slice of the training rows (same rows in R).
        fit, val = csboost.early_stopping_split(len(y), PARAMS["validation_fraction"], SEED)
        part = lambda idx: xgb.DMatrix(X[idx], label=y[idx], weight=None if w is None else w[idx], missing=np.nan)  # noqa: E731
        return xgb.train(
            XGB_PARAMS,
            part(fit),
            num_boost_round=rounds,
            evals=[(part(val), "valid")],
            early_stopping_rounds=int(PARAMS["early_stopping"]),
            verbose_eval=False,
        )
    return xgb.train(XGB_PARAMS, xgb.DMatrix(X, label=y, weight=w, missing=np.nan), num_boost_round=rounds)


def predict_model(model, X):
    best = model.attr("best_iteration")  # set by early stopping (0-based), kept in model.ubj
    span = (0, int(best) + 1) if best is not None else (0, 0)
    return model.predict(xgb.DMatrix(X, missing=np.nan), iteration_range=span)


def feature_importance(model, names):
    # Total gain per feature as a share of all gain (= R's xgb.importance()$Gain).
    gain = model.get_score(importance_type="total_gain")  # keys f0, f1, … (columns by position)
    total = sum(gain.values()) or 1.0
    return {names[int(k[1:])]: v / total for k, v in gain.items()}


def save_model(model, directory):
    path = os.path.join(directory, "model.ubj")
    model.save_model(path)  # loads in Python and R alike
    return [{"key": "model", "path": path, "format": "xgboost-ubj"}]


def load_model(directory):
    model = xgb.Booster()
    model.load_model(os.path.join(directory, "model.ubj"))
    return model


# %% Explain the model
import json

from codesplash.ml import explain as csx

REQUEST = json.loads("{\"analyze\":{\"kind\":\"shap\",\"method\":\"explain.shap\",\"model\":\"learn.xgboost/multiclass_penguins\",\"title\":\"SHAP values for a saved model\",\"version\":\"1.1.0\"},\"class\":\"Gentoo\",\"coalitions\":256,\"kernelBackground\":30,\"kernelRows\":40,\"maxRows\":40,\"methods\":[\"shap\"],\"modelDir\":\"model-python/out\",\"rows\":\"auto\",\"shapRows\":40}") or {}
model_dir = REQUEST.get("modelDir") or out
with open(os.path.join(model_dir, "design.json"), encoding="utf-8") as fh:
    prep = csml.FittedDesign.from_json(fh.read())
model = load_model(model_dir)
explainer = csx.Explainer(predict_model, model, prep, TASK, CLASSES, POSITIVE, METRIC, cls=REQUEST.get("class"))
rows = csx.explain_rows(plan, REQUEST.get("rows") or "auto", int(REQUEST.get("maxRows") or 1000), SEED)
cs.publish(
    csx.explain(
        explainer,
        df,
        rows,
        plan.train,
        y,
        y_index,
        REQUEST,
        SEED,
        model_dir,
        out,
        warnings=warnings,
        title="XGBoost",
        engine=cs.engine_info("xgboost", "numpy", "pandas"),
    )
)

For a boosted model of Gentoo penguins, the base value is 0.042 on the log-odds scale, and the most important feature is flipper_len, with a mean absolute value of 1.84. For the interventional game, choose algorithm Kernel with a background sample: an estimate of the same quantity.

05

Predict: global importance from local values

Predict

Predict first

You rank features by the mean absolute TreeSHAP value over all rows. What does the top feature's high mean tell you?

It tells you the feature matters for every rowIt summarizes size, not sign or who it matters for
Reveal

Size, not sign or who. The mean of absolute values loses direction and hides heterogeneity: a feature can matter hugely for a few rows and not at all for most. Look at the beeswarm (sign and spread) and at subgroups, and say which rows you averaged over.

06

Pitfalls

Read
  • Name the game. Path-dependent and interventional values answer different questions; correlated predictors can swap credit between them.
  • Name the scale. Log-odds values don't add up on the probability scale.
  • Aggregate deliberately. A global mean of absolute attribution isn't the importance for any one case.
  • Explanations aren't evaluations. TreeSHAP describes the fitted model; it is no substitute for held-out performance or fairness checks.
07

Where it stands in CodeSplash

Read
EntryIn CodeSplash
TreeSHAP (EXP003)Runs in CodeSplash: path-dependent TreeSHAP for XGBoost and LightGBM in SHAP values for a saved model and the Explain tab, Python ≡ R; the interventional game is available as a KernelSHAP estimate with a background sample
08

Check your understanding

Checkpoint

Check yourself

Why can TreeSHAP compute exact Shapley values quickly when KernelSHAP has to sample?

Show the answer

Answer: b

Tree structure lets the subset sum be computed path by path. The result is exact for the chosen value function.

Check yourself

Two strongly correlated features, A and B. Path-dependent TreeSHAP gives A a large value; interventional TreeSHAP gives B more. Which is wrong?

Show the answer

Answer: c

Report which game you used. When they disagree, group the correlated features or present both views.

Check yourself

A boosted classifier's TreeSHAP values for one row add up to 1.2. What does that number mean?

Show the answer

Answer: b

Boosters' TreeSHAP is additive in margin (log-odds) units. Convert carefully, and don't add log-odds contributions as if they were probabilities.

09

Recap

Recap
  • TreeSHAP computes exact Shapley values from tree paths, additive on the model's margin scale.
  • Path-dependent (training cover) and interventional (background) games can disagree under correlation.
  • Mean absolute values lose sign and heterogeneity; aggregate deliberately.

Concepts in this lesson