lambda.glinternet.cv(X, Y, numLevels, nFolds = 10, lambda=NULL, nLambda=50, lambdaMinRatio=0.01,
screenLimit=NULL, family=c("gaussian", "binomial"), tol=1e-5, maxIter=5000,
verbose=FALSE, numCores=1)X matrix as in glinternet.Y as in glinternet.numLevels as in glinternet.lambda as in glinternet.nLambda as in glinternet.lambdaMinRatio as in glinternet.screenLimit as in glinternet.family as in glinternet.tol as in glinternet.maxIter as in glinternet.verbose as in glinternet.numCores as in glinternet.glinternet.cv with the componentslambdaHat.Y). This
is from the model fitted at lambdaHat.activeSet is a list variables found for the
model fitted with lambdaHat.activeSet.lambda values used for the
cross validation.lambda that minimizes the cv
error curve.lambda that produces
a cv error that is within 1 standard deviation of the minimum cv
error. This will always be at least as large as lambdaHat.lambda.nFolds folds.lambda sequence is computed using all the
data. nFolds models are fit, each time with one of the folds
omitted. The error is accumulated, and the average error and standard deviation over the
folds is computed. The lambda value that minimizes the average
error is returned, and a model with this lambda is fit to the
full data set.glinternet, predict.glinternet,
predict.glinternet.cv, plot.glinternet.cvY = rnorm(100)
numLevels = sample(1:5, 10, replace=TRUE)
X = sapply(numLevels, function(x) if (x==1)
rnorm(100) else sample(0:(x-1), 100, replace=TRUE))
fit = glinternet.cv(X, Y, numLevels, nFolds=3)Run the code above in your browser using DataLab