Plot regularized model coefficients

# S3 method for interpret
plot(x, include_intercept = FALSE, max_char = 40, title,
  caption, font_size = 11, point_size = 3, print = TRUE, ...)

Arguments

x

A interpret object or a data frame with columns "variable" and "coefficient"

include_intercept

If FALSE (default) the intercept estimate will not be plotted

max_char

Maximum length of variable names to leave untruncated. Default = 40; use Inf to prevent truncation. Variable names longer than this will be truncated to leave the beginning and end of each variable name, bridged by " ... ".

title

Plot title. NULL for no title; character for custom title. If left blank contains the model class and outcome variable

caption

Plot caption, appears in lower-right. NULL for no caption; character for custom caption. If left blank the caption will contain info including the hyperparameter values of the model used by interpret to determine coefficient estimates.

font_size

Relative size of all fonts in plot, default = 11

point_size

Size of dots, default = 3

print

Print the plot? Default = TRUE

...

Unused

Value

A ggplot object, invisibly.

See also

Examples

machine_learn(mtcars, outcome = mpg, models = "glm", tune = FALSE) %>% interpret() %>% plot(font_size = 14)
#> Training new data prep recipe...
#> #> mpg looks numeric, so training regression algorithms.
#> #> After data processing, models are being trained on 10 features with 32 observations. #> Based on n_folds = 5 and hyperparameter settings, the following number of models will be trained: 50 glm's
#> Training at fixed values: glmnet
#> #> *** Models successfully trained. The model object contains the training data minus ignored ID columns. *** #> *** If there was PHI in training data, normal PHI protocols apply to the model object. ***