The function stacks the SHAP values for each observation and shows how the final output was obtained as a sum of each predictor’s attributions through the force plot. (Randomly plotting a certain portion of the data is optional in case the dataset is large.)
plot_shap_force(
shap_se,
top_feature = 10,
cluster_method = "ward.D",
group_num = 10
)
A SummarizedExperiment object with results computed by ml_shap
.
Integer. Top number of features to be shown. If top_feature
is set to greater than 10, only the top 10 samples will be displayed. Default is 10
.
Character. The clustering method. Allowed methods include
"ward.D", "ward.D2", "single", "complete", "average", "mcquitty", "median", "centroid".
Default is 'ward.D'
.
Integer. The numbers of groups to be shown in the plots.
Default is 10
.
Return 1 interactive plot, 1 static plot, and 1 table.
interactive_forcePlot & static_forcePlot: SHAP force plot.
table_forcePlot: table for plotting force plot.
data("ml_se_sub")
shap_se <- shap(ml_se_sub, feature_num=10, nsim=5)
#> Error in shap(ml_se_sub, feature_num = 10, nsim = 5): could not find function "shap"
res <- plot_shap_force(shap_se, top_feature=10, cluster_method="ward.D", group_num=10)
#> Error in isFALSE(inherits(se, "SummarizedExperiment")): object 'shap_se' not found