This function visualizes the SHAP values against the feature values for each variable.

plot_shap_dependence(shap_se, feature, shap_feature, interaction_index)

Arguments

shap_se

A SummarizedExperiment object with results computed by ml_shap.

feature

Character. A character string of the feature name the user selects from the "variable" column in shap_result. (Use extract_summarized_experiment to view shap_result.)

shap_feature

Character. A character string of the feature name the user selects from the "variable" column of shap_result. (Use extract_summarized_experiment to view shap_result.)

interaction_index

Character. A character string of the feature name the user selects from the "variable" column of shap_result. (Use extract_summarized_experiment to view shap_result.)

Value

Return 1 interactive plot, 1 static plot, 1 table.

  1. interactive_dependence_plot & static_dependence_plot: SHAP dependence plot.

  2. table_dependence_plot: table for plotting SHAP dependence plot

Examples

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"
selected_feature <- as.character(unique(S4Vectors::metadata(shap_se)$shap_result$variable))
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'metadata': object 'shap_se' not found
res <- plot_shap_dependence(
    shap_se, feature=selected_feature[1], shap_feature=selected_feature[2],
    interaction_index=selected_feature[2])
#> Error in isFALSE(inherits(se, "SummarizedExperiment")): object 'shap_se' not found