Learn R Programming

DALEXtra (version 1.3.2)

triplot: Three plots that sum up automatic aspect importance grouping

Description

This function shows:

  • plot for aspect_importance with single aspect

  • tree that shows aspect_importance for every newly expanded aspect

  • clustering tree.

Usage

triplot(x, ...)

# S3 method for explainer triplot( x, new_observation, N = 500, clust_method = "complete", absolute_value = FALSE, cumulative_max = FALSE, add_importance_labels = TRUE, show_axis_y_duplicated_labels = FALSE, axis_lab_size = 10, text_size = 3, ... )

# S3 method for default triplot( x, data, predict_function = predict, new_observation, N = 500, clust_method = "complete", absolute_value = FALSE, cumulative_max = FALSE, add_importance_labels = TRUE, show_axis_y_duplicated_labels = FALSE, abbrev_labels = 0, axis_lab_size = 10, text_size = 3, ... )

Arguments

x

an explainer created with the DALEX::explain() function or a model to be explained.

...

other parameters

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

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

add_importance_labels

if TRUE, first plot is annotated with values of aspects importance

show_axis_y_duplicated_labels

if TRUE, every plot will have annotated axis Y

axis_lab_size

size of labels on axis

text_size

size of labels annotating values of aspects importance and correlations

data

dataset, it will be extracted from x if it's an explainer NOTE: Target variable shouldn't be present in the data

predict_function

predict function, it will be extracted from x if it's an explainer

abbrev_labels

if greater than 0, labels for axis Y in single aspect importance plot will be abbreviated according to this parameter

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[30,-1]
apartments_num_mod <- apartments_num[,-1]
triplot(x = apartments_num_lm_model,
  data = apartments_num_mod,
  new_observation = apartments_num_new_observation,
  add_importance_labels = FALSE)


# }

Run the code above in your browser using DataLab