Learn R Programming

DALEXtra (version 0.2.1)

plot_aspects_importance_grouping: Function plots tree with aspect importance values

Description

This function plots tree that shows order of feature grouping and aspect importance values of every newly created aspect.

Usage

plot_aspects_importance_grouping(
  x,
  data,
  predict_function = predict,
  new_observation,
  N = 100,
  clust_method = "complete",
  absolute_value = FALSE,
  cumulative_max = FALSE,
  show_labels = TRUE,
  axis_lab_size = 10,
  text_size = 3
)

Arguments

x

a model to be explained

data

dataset, should be without target variable

predict_function

predict function

new_observation

selected observation with columns that corresponds to variables used in the model, should be without target variable

N

number of observations to be sampled (with replacement) from data

clust_method

the agglomeration method to be used, see hclust methods

absolute_value

if TRUE, aspect importance values will be drawn as absolute values

cumulative_max

if TRUE, aspect importance shown on tree will be max value of children and node aspect importance values

show_labels

if TRUE, plot will have annotated axis Y

axis_lab_size

size of labels on axis Y, if applicable

text_size

size of labels annotating values of aspects importance

Value

ggplot

Examples

Run this code
# NOT RUN {
library(DALEX)
apartments_num <- apartments[,unlist(lapply(apartments, is.numeric))]
apartments_num_lm_model <- lm(m2.price ~ ., data = apartments_num)
apartments_num_new_observation <- apartments_num[2,-1]
apartments_num_mod <- apartments_num[,-1]
plot_aspects_importance_grouping(x = apartments_num_lm_model,
data = apartments_num_mod, new_observation = apartments_num_new_observation)


# }

Run the code above in your browser using DataLab