animate_glmnet: Animate glmnet

animate_glmnetR Documentation

Animate glmnet

Description

This function visualizes the a cv.glmnet machine learning process.

Usage

animate_glmnet(cv.glmnet, replay = FALSE, plot.cv = TRUE,
  total.time = ifelse(plot.cv, 15, 10), new.save = TRUE, save = "html",
  debug = FALSE, debug.n = 10, captions = FALSE, alt.captions = FALSE,
  transition.n = 10, ...)

Arguments

cv.glmnet

An object of class 'cv.glmnet'

replay

Should the animation be replayed in the visual device? Defaults to FALSE.

plot.cv

Should cross-validation be plotted? Defaults to TRUE.

total.time

Desired time of animation in seconds. Defaults to 15 if plot.cv selected, else 10.

new.save

Should this animation be saved as a new object rather than overwrite the preceeding animation? Defaults to TRUE.

save

Save as "html" or "gif"? Defaults to "html".

debug

Only plot subset of lambda values? Defaults to FALSE.

debug.n

If plotting subset of lambda values, sets number of values to plot. Defaults to 10.

captions

Should captions be added to animation? Defaults to FALSE.

transition.n

How many frames should be used to transition between cross-validation and model fit? Defaults to 10.

...

Options passed to saveHTML or saveGIF functions. See ?animate::saveHTML and ?animate::saveGIF

captions.alt

Should alternative captions be added to animation? Defaults to FALSE.

Examples

# See also: ?cv.glmnet:
set.seed(1010)
n=1000;p=100
nzc=trunc(p/10)
x=matrix(rnorm(n*p),n,p)
beta=rnorm(nzc)
fx= x[,seq(nzc)] %*% beta
eps=rnorm(n)*5
y=drop(fx+eps)
px=exp(fx)
px=px/(1+px)
ly=rbinom(n=length(px),prob=px,size=1)
set.seed(1011)
cvob1=cv.glmnet(x,y)
animate_glmnet(cvob1)

sondreus/seeAI documentation built on June 28, 2023, 8:23 a.m.