Breaks the model's prediction for a single casualty into per-predictor contributions, using SHAP values. This answers "why this casualty?", as opposed to importance, which answers "what does this model use in general?".
Arguments
- x
An
sdt_modelfromsdt_fit(), or an explainer fromsdt_explain().- casualty
A one-row data frame, or the
idof a casualty indata.- data
Optional data to explain on, passed to
sdt_explain(). Also wherecasualtyis looked up when given as an id.- n_permutations
Number of sampling rounds for the SHAP estimate.
Examples
# See ?sdt_importance for a runnable example.
sdt_engines()
#> # A tibble: 9 × 4
#> engine package class_box installed
#> <chr> <chr> <chr> <lgl>
#> 1 tree rpart glass TRUE
#> 2 multinom nnet glass TRUE
#> 3 glmnet glmnet glass TRUE
#> 4 mars earth grey TRUE
#> 5 xgboost xgboost grey TRUE
#> 6 ranger ranger black TRUE
#> 7 svm_rbf kernlab black TRUE
#> 8 mlp nnet black TRUE
#> 9 transformer keras3 closed TRUE