Reputation: 31
I've recently run a code which is:
glmnet.fit <- with(training.df, glmnet(poly(X, degree = 10), Y))
lambdas <- glmnet.fit$lambda
performance <- data.frame()
for (lambda in lambdas)
{
performance <- rbind(performance,
data.frame(Lambda = lambda,
RMSE = rmse(test.y,
with(test.df,
predict(glmnet.fit,
poly(X, degree = 10),
s = lambda)))))
}
what does the parameter 's' in this case mean?Could't find it in the help file.
Upvotes: 1
Views: 325
Reputation: 974
To find the documentation of the predict
function for different objects, you can usually use ?predict.objectName
. So for instance, to find the documentation for the predict
function for lm
objects, you'd use ?predict.lm
.
In this case, you have a glmnet
object, and you can use ?predict.glmnet
to find the relevant documentation, which describes s
as follows:
s
- Value(s) of the penalty parameter lambda at which predictions are required. Default is the entire sequence used to create the model.Upvotes: 1