predict.cv.sparseSVM {sparseSVM} | R Documentation |
This function returns fitted values, coefficients and more from a fitted "cv.sparseSVM"
object.
## S3 method for class 'cv.sparseSVM' predict(object, X, lambda = object$lambda.min, type = c("class","coefficients","nvars"), exact = FALSE, ...) ## S3 method for class 'cv.sparseSVM' coef(object, lambda = object$lambda.min, exact = FALSE, ...)
object |
Fitted |
X |
Matrix of values at which predictions are to be made. Used only for |
lambda |
Values of the regularization parameter |
type |
Type of prediction. |
exact |
If |
... |
Not used. Other arguments to predict. |
The object returned depends on type.
Congrui Yi and Yaohui Zeng
Maintainer: Congrui Yi <eric.ycr@gmail.com>
X = matrix(rnorm(1000*100), 1000, 100) b = 3 w = 5*rnorm(10) eps = rnorm(1000) y = sign(b + drop(X[,1:10] %*% w + eps)) cv.fit <- cv.sparseSVM(X, y, ncores = 2, seed = 1234) predict(cv.fit, X) predict(cv.fit, type = 'nvars') predict(cv.fit, type = 'coef') coef(cv.fit)