plot.aspect_importance {triplot} | R Documentation |
Function for plotting aspect_importance results
Description
This function plots the results of aspect_importance.
Usage
## S3 method for class 'aspect_importance'
plot(
x,
...,
bar_width = 10,
show_features = aspects_on_axis,
aspects_on_axis = TRUE,
add_importance = FALSE,
digits_to_round = 2,
text_size = 3
)
Arguments
x |
object of aspect_importance class |
... |
other parameters |
bar_width |
bar width |
show_features |
if TRUE, labels on axis Y show aspect names, otherwise they show features names |
aspects_on_axis |
alias for |
add_importance |
if TRUE, plot is annotated with values of aspects importance |
digits_to_round |
integer indicating the number of decimal places used for rounding values of aspects importance shown on the plot |
text_size |
size of labels annotating values of aspects importance, if applicable |
Value
a ggplot2 object
Examples
library("DALEX")
model_titanic_glm <- glm(survived == 1 ~
class+gender+age+sibsp+parch+fare+embarked,
data = titanic_imputed,
family = "binomial")
explain_titanic_glm <- explain(model_titanic_glm,
data = titanic_imputed[,-8],
y = titanic_imputed$survived == 1,
verbose = FALSE)
aspects <- list(wealth = c("class", "fare"),
family = c("sibsp", "parch"),
personal = c("gender", "age"),
embarked = "embarked")
titanic_ai <- predict_aspects(explain_titanic_glm,
new_observation = titanic_imputed[1,],
variable_groups = aspects)
plot(titanic_ai)
[Package triplot version 1.3.0 Index]