Description Usage Arguments Examples
Interactive coefficient profile plot for glmnet objects.
1 | fdPlotGlmnet(x, xvar = c("norm", "lambda", "dev"), title = NULL, ...)
|
x |
a glmnet model object |
xvar |
What is on the X-axis. "norm" plots against the L1-norm of the coefficients, "lambda" against the log-lambda sequence, and "dev" against the percent deviance explained. |
title |
plot title. |
... |
extra arguments passed to every series being plotted |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | library(glmnet)
library(flightdeck)
data(QuickStartExample)
fit <- glmnet(x, y)
if (interactive()){
#' Interctive profiles plot
fdPlotGlmnet(fit)
# Use lambda as xvar
fdPlotGlmnet(fit, xvar = 'lambda')
# Don't show legend
fdPlotGlmnet(fit, showlegend = FALSE)
# Putting everything in a tabset panel
fdTabsetPanel(selected = 'L1 Norm',
fdTabPanel('L1 Norm', fdPlotGlmnet(fit, xvar = 'norm')),
fdTabPanel('Lambda', fdPlotGlmnet(fit, xvar = 'lambda')),
fdTabPanel('Deviance', fdPlotGlmnet(fit, xvar = 'dev'))
) %>%
fdColumn(width = 12) %>%
fdPreview(wrap = 'row')
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.