Description Usage Arguments Examples
View source: R/plot_explain_scatter.R
Visualize the explanation of interest (eoi) and LIME simulated data
1 2 3 4 5 6 7 8 | plot_explain_scatter(
explanation,
bins = TRUE,
weights = TRUE,
alpha = 1,
line_size = 1,
title.opt = TRUE
)
|
explanation |
Rows from the LIME explanations associated with one prediction of interest |
bins |
Should lines indicating the bins used by LIME be included? Only applicable is sim_method is equal to "quantile_bins" or "equal_bins". (Default is TRUE.) |
weights |
Should the size of the points represent the weight assigned by LIME? (Default is TRUE.) |
alpha |
Value to use for alpha blending of the points |
line_size |
Size of the lines used for representing the explainer model |
title.opt |
Should a title be included that lists the simulation method and Gower exponent? (Default is TRUE.) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # Prepare training and testing data
x_train = sine_data_train[c("x1", "x2", "x3")]
y_train = factor(sine_data_train$y)
x_test = sine_data_test[1:5, c("x1", "x2", "x3")]
# Fit a random forest model
rf <- randomForest::randomForest(x = x_train, y = y_train)
# Run apply_lime
res <- apply_lime(train = x_train,
test = x_test,
model = rf,
label = "1",
n_features = 2,
sim_method = c('quantile_bins',
'kernel_density'),
nbins = 2:3,
return_perms = TRUE)
# Extract the rows associtaed with an explanation
# of interest (the first observation in the test data)
eoi <- res$explain[1:2,]
# Plot the explanation of interest
plot_explain_scatter(eoi)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.