Skip to contents

What explain does to a model fitted by each supervised algorithm: which estimator setup_SHAP(estimator = "auto") resolves to, whether that answer is exact, which value function it computes, and why.

Usage

explanation_methods(algorithm = NULL)

Arguments

algorithm

Optional Character: Name of a supervised algorithm, matched case-insensitively. NULL returns every algorithm.

Value

data.frame: One row per algorithm.

Details

The columns:

name

The algorithm, as named by setup_<name>().

estimator

The estimator "auto" resolves to. "KernelSHAP" is the model-agnostic fallback and applies to every algorithm; the others are exact and algorithm-specific.

exact

TRUE if the estimator returns Shapley values rather than an estimate of them, NA where that depends on the fitted model rather than on the algorithm – an ensemble whose meta-learner turned out to be linear, or a model that has one linear map for a regression or binary outcome but not for a multiclass one. An NA row explains what it did when asked, and refuses with a message naming the reason when it cannot.

perturbation

The value function computed when setup_SHAP(perturbation = ) is left NULL.

rationale

Why this estimator, in one line.

estimator = "kernel" is always available, so a row whose exact is FALSE is saying that estimator = "exact" has nothing to offer for it – not that the algorithm cannot be explained.

Author

EDG

Examples

explanation_methods()
#>                       name  estimator exact
#> 1                     BART KernelSHAP FALSE
#> 2                     CART   TreeSHAP  TRUE
#> 3  ConditionalSuperLearner ExpertSHAP    NA
#> 4                      GAM   GAMTerms    NA
#> 5                      GLM LinearSHAP  TRUE
#> 6                   GLMNET LinearSHAP  TRUE
#> 7                  GLMTree KernelSHAP FALSE
#> 8                      HAL   HALBasis    NA
#> 9                 Isotonic   Isotonic  TRUE
#> 10            MonotonicHAL   HALBasis    NA
#> 11                     KNN KernelSHAP FALSE
#> 12               LightCART   TreeSHAP  TRUE
#> 13                LightGBM   TreeSHAP  TRUE
#> 14                 LightRF   TreeSHAP  TRUE
#> 15            LightRuleFit KernelSHAP FALSE
#> 16                   LINAD KernelSHAP FALSE
#> 17             LINADForest KernelSHAP FALSE
#> 18                    MARS  MARSBasis    NA
#> 19                     MLP KernelSHAP FALSE
#> 20        ModalityStacking KernelSHAP FALSE
#> 21                    NNLS LinearSHAP  TRUE
#> 22                  Ranger KernelSHAP FALSE
#> 23            SuperLearner KernelSHAP FALSE
#> 24               LinearSVM LinearSHAP    NA
#> 25               RadialSVM KernelSHAP FALSE
#> 26                    SPLS LinearSHAP    NA
#> 27                  TabNet KernelSHAP FALSE
#>                                                                                                                                                                              rationale
#> 1                                                                                        No additive structure to read; the posterior gives a better uncertainty story than SHAP does.
#> 2                                                                                                                       TreeSHAP over a single tree is a short traversal and is exact.
#> 3                                                     An oracle routes each case to one expert, which predicts it alone -- so the expert explains it, exactly, with its own estimator.
#> 4                        predict(type = 'terms') returns the additive decomposition for a regression or binary fit; a multiclass fit has one linear predictor per non-reference class.
#> 5                                                                                                                    Coefficients give phi_j = beta_j * (x_j - E[x_j]) in closed form.
#> 6                                                                                                                    Coefficients give phi_j = beta_j * (x_j - E[x_j]) in closed form.
#> 7                                                Linear within a leaf, but the tree routes on the same features, so a leaf's coefficients account for only part of what the model did.
#> 8                                                                      A lasso over basis functions, exact where every selected basis reads one feature -- which needs max_degree = 1.
#> 9                                                                                                                           One feature carries the whole deviation from the baseline.
#> 10                                                                     A lasso over basis functions, exact where every selected basis reads one feature -- which needs max_degree = 1.
#> 11                                                                                                        No parametric structure to read; distances are not additive in the features.
#> 12                                                                                                                      TreeSHAP over a single tree is a short traversal and is exact.
#> 13                                                                                                            predict(type = 'contrib') returns contributions from the booster itself.
#> 14                                                                                                            predict(type = 'contrib') returns contributions from the booster itself.
#> 15                                                   A sparse linear model over rules, not a booster; a rule is a conjunction of conditions, so it is not additive in single features.
#> 16                                            Linear within a leaf, but the splits that route a case read the same features, so its coefficients account for only part of what it did.
#> 17         One tree is linear within a leaf and already only partly readable from its coefficients; a mean over trees, each routing on the same features, is no more additive in them.
#> 18                                              Additive in its basis functions for a regression fit; classification adds a GLM over them, and an interaction term reads two features.
#> 19                                                                                   A network has no additive structure to read; Expected Gradients would be cheaper but is deferred.
#> 20 A weighted sum of base explanations is exact for a linear meta-learner only when every base computes the same value function, and each exact estimator computes one value function.
#> 21                                                                                                                   Coefficients give phi_j = beta_j * (x_j - E[x_j]) in closed form.
#> 22                                                                                   TreeSHAP covers rpart and LightGBM trees; a ranger forest is explained with the kernel estimator.
#> 23 A weighted sum of base explanations is exact for a linear meta-learner only when every base computes the same value function, and each exact estimator computes one value function.
#> 24                                                                                    The decision function is linear for a regression or binary fit; multiclass is one-vs-one voting.
#> 25                                                                                                                   The kernel makes the decision function nonlinear in the features.
#> 26                                                                           Linear in the features for regression and binary; multiclass scores are identified only up to a constant.
#> 27                                                                                                                     Attention masks are native and free but are not Shapley values.
#>      perturbation
#> 1  interventional
#> 2     conditional
#> 3  interventional
#> 4  interventional
#> 5  interventional
#> 6  interventional
#> 7  interventional
#> 8  interventional
#> 9  interventional
#> 10 interventional
#> 11 interventional
#> 12    conditional
#> 13    conditional
#> 14    conditional
#> 15 interventional
#> 16 interventional
#> 17 interventional
#> 18 interventional
#> 19 interventional
#> 20 interventional
#> 21 interventional
#> 22 interventional
#> 23 interventional
#> 24 interventional
#> 25 interventional
#> 26 interventional
#> 27 interventional
explanation_methods("Ranger")
#>     name  estimator exact
#> 1 Ranger KernelSHAP FALSE
#>                                                                                           rationale
#> 1 TreeSHAP covers rpart and LightGBM trees; a ranger forest is explained with the kernel estimator.
#>     perturbation
#> 1 interventional
# Which algorithms have an exact estimator?
em <- explanation_methods()
em[["name"]][!is.na(em[["exact"]]) & em[["exact"]]]
#> [1] "CART"      "GLM"       "GLMNET"    "Isotonic"  "LightCART" "LightGBM" 
#> [7] "LightRF"   "NNLS"