Description Usage Arguments Value Examples
View source: R/hierarchical_importance.R
This function creates a tree that shows order of feature grouping and calculates importance of every newly created aspect.
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 26  hierarchical_importance(
x,
data,
y = NULL,
predict_function = predict,
type = "predict",
new_observation = NULL,
N = 1000,
loss_function = DALEX::loss_root_mean_square,
B = 10,
fi_type = c("raw", "ratio", "difference"),
clust_method = "complete",
cor_method = "spearman",
...
)
## S3 method for class 'hierarchical_importance'
plot(
x,
absolute_value = FALSE,
show_labels = TRUE,
add_last_group = TRUE,
axis_lab_size = 10,
text_size = 3,
...
)

x 
a model to be explained. 
data 
dataset
NOTE: Target variable shouldn't be present in the 
y 
true labels for 
predict_function 
predict function 
type 
if 
new_observation 
selected observation with columns that corresponds to variables used in the model, should be without target variable 
N 
number of rows to be sampled from data
NOTE: Small 
loss_function 
a function that will be used to assess variable
importance, if 
B 
integer, number of permutation rounds to perform on each variable
in feature importance calculation, if 
fi_type 
character, type of transformation that should be applied for
dropout loss, if 
clust_method 
the agglomeration method to be used, see

cor_method 
the correlation method to be used see

... 
other parameters 
absolute_value 
if TRUE, aspects importance values will be drawn as absolute values 
show_labels 
if TRUE, plot will have annotated axis Y 
add_last_group 
if TRUE, plot will draw connecting line between last two groups 
axis_lab_size 
size of labels on axis Y, if applicable 
text_size 
size of labels annotating values of aspects importance 
ggplot
1 2 3 4 5 6 7 8  library(DALEX)
apartments_num < apartments[,unlist(lapply(apartments, is.numeric))]
apartments_num_lm_model < lm(m2.price ~ ., data = apartments_num)
hi < hierarchical_importance(x = apartments_num_lm_model,
data = apartments_num[,1],
y = apartments_num[,1],
type = "model")
plot(hi, add_last_group = TRUE, absolute_value = TRUE)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.