SHAP Dependence Plot for Selected Features
Source:R/SpaPheno_SHAP_dependence_plot.R
SpaPheno_SHAP_dependence_plot.Rd
Visualizes the relationship between SHAP values and corresponding feature values across samples, stratified by selected features.
Arguments
- shap_df
A data.frame with SHAP output. Must contain columns:
feature
: Name of the feature.feature.value
: The actual value of the feature in a sample.phi
: The SHAP value associated with that feature/sample.
- feature_names
Character vector of feature names to include in the plot.
- title
Optional character string for the plot title. Default is
"SHAP Dependence Plot"
.
Details
This function generates a scatter plot of SHAP values versus feature values,
overlaid with a LOESS smoothed curve. Each feature specified in feature_names
is plotted in a separate facet panel. Useful for interpreting the directionality
and interaction effects of SHAP-based model explanations.