View source: R/plots_Shapley.r
| plot_tile_int_Shapley | R Documentation |
Tileplot of Shapley values for interval-valued data.
plot_tile_int_Shapley(
shapley,
outliers = NULL,
rotate_x = TRUE,
abbrev.var = FALSE,
abbrev.obs = FALSE,
sort.var = FALSE,
sort.obs = FALSE,
show_values = FALSE
)
shapley |
A |
outliers |
A list containing the outliers' names as returned by |
rotate_x |
Logical. If |
abbrev.var |
Integer. If |
abbrev.obs |
Integer. If |
sort.var |
Logical. If |
sort.obs |
Logical. If |
show_values |
Logical. If |
Returns a tileplot that displays the Shapley values (int_Shapley) for each observation and variable. Optionally, only the outliers are highlighted in the plot.
Adapted from package ShapleyOutlier (https://CRAN.R-project.org/package=ShapleyOutlier).
# Create intData object
data(creditcard)
credit_card_int <- creditcard$intData
# Estimate the mean and covariance matrix
credit_card_IMCD <- IMCD(credit_card_int,
m = floor(nrow(credit_card_int)*0.75),
cutoff = "farness",
cutoff_lvl = 0.9)
# Detect outliers using farness cutoff
credit_card_outliers <- int_outliers(credit_card_IMCD$robust_dist,
cutoff = "farness",
cutoff_lvl = 0.9)
# Compute Shapley values
credit_card_shapley <- int_Shapley(credit_card_int,
mean_c = credit_card_IMCD$mean_IMCD_c,
mean_r = credit_card_IMCD$mean_IMCD_r,
cov = credit_card_IMCD$cov_IMCD)
plot_tile_int_Shapley(credit_card_shapley,
outliers = credit_card_outliers,
sort.var = TRUE,
sort.obs = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.