predict.cv.dcsvm | R Documentation |
Predicts class labels for new data based on the cross-validated lambda
values from a cv.dcsvm
object.
## S3 method for class 'cv.dcsvm'
predict(object, newx, s = c("lambda.1se", "lambda.min"), ...)
object |
A fitted |
newx |
A matrix of new values for |
s |
Value(s) of the L1 tuning parameter |
... |
Not used. Other arguments to |
Make Predictions from a "cv.dcsvm" Object
This function predicts the class labels of new observations using the sparse density-convoluted SVM at the lambda
values suggested by cv.dcsvm
.
This function uses the cross-validation results to make predictions. It is adapted from the predict.cv
function in the glmnet
and gcdnet
packages.
Predicted class labels or fitted values, depending on the choice of s
and any arguments passed to the dcsvm
method.
cv.dcsvm
, and coef.cv.dcsvm
methods.
data(colon)
colon$x <- colon$x[ , 1:100] # Use only the first 100 columns for this example
set.seed(1)
cv <- cv.dcsvm(colon$x, colon$y, lam2=1, nfolds=5)
predict(cv$dcsvm.fit, newx=colon$x[2:5, ],
s=cv$lambda.1se, type="class")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.