Variable importance summarizes a fitted model across predictors. Shapley contributions describe the prediction for an individual case relative to a background distribution. Both describe the fitted predictive relationship; causal interpretation requires additional assumptions and study design.
2026-10-08 02:54:01 Checking data is ready for training... ✔ [check_supervised]
2026-10-08 02:54:01 ▶ [train]2026-10-08 02:54:02 Training set: 32 cases x 3 features. [summarize_supervised]2026-10-08 02:54:02 //CPU | serial | 1 worker: algorithm 1 thread, tuning 1, outer resampling 1 [msg_resources]2026-10-08 02:54:02 Shared memory (auto): not sharing training data (4.5 kB) -- this run transfers nothing to workers. [report_shared_memory]2026-10-08 02:54:02 Training GLM Regression... [train]2026-10-08 02:54:02 Checking data is ready for training... ✔ [check_supervised]
<VariableImportance>Coefficient (coefficient, 4 entries): Estimated coefficient of each model term, including the intercept, on the scale of the linear predictor, per unit of the term as the model received it.
VariableImportance stores named measures, each with metadata describing its meaning, evaluation sample, sign, dependence on predictor units, and ranking direction. varimp_table() combines the measures into a data frame. plot_varimp(measure = ...) selects a measure and uses its ranking direction. Coefficient magnitudes, split gain, permutation scores, and cross-validated risk represent different quantities.
The background defines the reference against which contributions are measured. setup_SHAP() controls estimator, perturbation, output scale, background sample size, and coalitions. explanation_methods() lists the automatic estimator for each algorithm and whether it is exact.
For this linear example, baseline plus contributions reconstructs the prediction. Other methods report contributions on the configured output scale. Approximate estimators also introduce estimation error.
shap_by_level() summarizes factor levels. get_varimp(explanation) aggregates contributions across the explained cases. explain() on a resampled model supports averaged or per-model explanations through type.