This method provides a good visualization method for model results. Currently, only methods for glmnet models are implemented.
# S3 method for model_fit
autoplot(object, ...)# S3 method for glmnet
autoplot(object, ..., min_penalty = 0, best_penalty = NULL, top_n = 3L)
A ggplot object with penalty on the x-axis and coefficients on the y-axis. For multinomial or multivariate models, the plot is faceted.
A model fit object.
For autoplot.glmnet()
, options to pass to
ggrepel::geom_label_repel()
. Otherwise, this argument is ignored.
A single, non-negative number for the smallest penalty
value that should be shown in the plot. If left NULL
, the whole data
range is used.
A single, non-negative number that will show a vertical
line marker. If left NULL
, no line is shown. When this argument is used,
the ggrepl package is required.
A non-negative integer for how many model predictors to label.
The top predictors are ranked by their absolute coefficient value. For
multinomial or multivariate models, the top_n
terms are selected within
class or response, respectively.
The glmnet package will need to be attached or loaded for
its autoplot()
method to work correctly.