autoplot.cv.glmnet: Plot cross-validated elastic net paths

Description Usage Arguments Value Examples

View source: R/plotting.R

Description

Plots paths for features in the final model in color and provides a legend for these features only. Features not in the final are plotted in grey and not included in the legend.

Usage

1
2
## S3 method for class 'cv.glmnet'
autoplot(object, rule = "1-se", ...)

Arguments

object

Object of class cv.glmnet

rule

Either "min" or "1-se". Specifies whether lambda should be selected to minimize CV error, or to find the sparsest model within one standard deviation of the minimum error. Default cv.glmnet behavior is to use the one standard error rule, following Breiman.

...

Other arguments to autoplot. Ignored.

Value

ggplot2 object with elastic net paths

Examples

1
2
3
4
5
6
7
8
library(glmnet)
data(Boston, package = "MASS")

X <- model.matrix(medv ~ ., Boston)
y <- Boston$medv
cv_model <- cv.glmnet(X, y)

autoplot(cv_model, rule = "min")

alexpghayes/hayeslib documentation built on May 5, 2019, 4:47 p.m.