| potential_interactions {shapviz} | R Documentation |
Interaction Strength
Description
Returns a vector of interaction strengths between variable v and all other
variables, see Details.
Usage
potential_interactions(
obj,
v,
nbins = NULL,
color_num = TRUE,
scale = FALSE,
adjusted = FALSE
)
Arguments
obj |
An object of class "shapviz". |
v |
Variable name to calculate potential SHAP interactions for. |
nbins |
Into how many quantile bins should a numeric |
color_num |
Should other ("color") features |
scale |
Should adjusted R-squared be multiplied with the sample variance of
within-bin SHAP values? If |
adjusted |
Should adjusted R-squared be used? Default is |
Details
If SHAP interaction values are available, the interaction strength
between feature v and another feature v' is measured by twice their
mean absolute SHAP interaction values.
Otherwise, we use a heuristic calculated as follows:
If
vis numeric, it is binned intonbinsbins.Per bin, the SHAP values of
vare regressed ontov, and the R-squared is calculated. Rows with missingv'are discarded.The R-squared are averaged over bins, weighted by the number of non-missing
v'values.
This measures how much variability in the SHAP values of v is explained by v',
after accounting for v.
Set scale = TRUE to multiply the R-squared by the within-bin variance
of the SHAP values. This will put higher weight to bins with larger scatter.
Set color_num = FALSE to not turn the values of the "color" feature v'
to numeric.
Finally, set adjusted = TRUE to use adjusted R-squared.
The algorithm does not consider observations with missing v' values.
Value
A named vector of decreasing interaction strengths.