Learn R Programming

relaxnet (version 0.3-2)

predict.cv.relaxnet: Predict Methods for cv.relaxnet and cv.alpha.relaxnet Objects

Description

Similar to other predict methods, this functions predicts fitted values, logits, coefficients and more from a fitted "cv.relaxnet" or "cv.alpha.relaxnet" object. By default, predictions are made at those values of the tuning parameters which "won" the cross-validation.

Usage

"predict"(object, newx, which.model = object$which.model.min, s = object$overall.lambda.min, type = c("link", "response", "coefficients", "nonzero", "class"), exact = FALSE, ...)
"predict"(object, newx, alpha.val = object$which.alpha.min, type = c("link", "response", "coefficients", "nonzero", "class"), ...)

Arguments

object
The object from which predictions are to be made.
newx
Matrix of new values for x at which predictions are to be made. Must be a matrix; can be sparse as in Matrix package. This argument is not used for type=c("coefficients","nonzero")
alpha.val
Value of alpha at which predictions are to be made. Default is to use that value which "won" the cross-validation.
which.model
Specifies the submodel from which predictions are required. "main" indicates the main glmnet model, while an integer indicates one of the relaxed models. Default for both functions is to use the submodel which "won" the cross-validation.
s
Value(s) of the penalty parameter lambda at which predictions are required. Default for both functions is to use that value which "won" the cross-validation.
type
See link[glmnet]{predict.glmnet}.
exact
Only the default, FALSE, is supported. See link[glmnet]{predict.glmnet}.
...
Further arguments passed to predict.relaxnet or to predict.cv.relaxnet (for the alpha version).

Value

The object returned depends on type.

See Also

relaxnet, cv.relaxnet, cv.alpha.relaxnet, predict.relaxnet, predict.glmnet