Learn R Programming

dcsvm (version 0.0.1)

predict.dcsvm: Make Predictions for Sparse Density-Convoluted SVM

Description

Predicts binary class labels or fitted values for a dcsvm model using new data.

Usage

# S3 method for dcsvm
predict(object, newx, s = NULL, type = c("class", "link"), ...)

Value

Returns either the predicted class labels or the fitted values, depending on the choice of type.

Arguments

object

A fitted dcsvm object.

newx

A matrix of new values for x at which predictions are to be made. Note that newx must be a matrix; vectors or other formats are not accepted.

s

Value(s) of the L1 tuning parameter lambda for computing coefficients. Default is the entire lambda sequence obtained by dcsvm.

type

"class" or "link"? "class" produces the predicted binary class labels, while "link" returns the fitted values. Default is "class".

...

Not used. Other arguments to predict.

Details

Make Predictions for Sparse Density-Convoluted SVM

This function predicts the binary class labels or the fitted values of a dcsvm object.

s represents the new lambda values for making predictions. If s is not part of the original lambda sequence generated by dcsvm, predict.dcsvm uses linear interpolation to compute predictions by combining adjacent lambda values in the original sequence. This functionality is adapted from the predict methods in the glmnet and gcdnet packages.

See Also

coef.dcsvm

Examples

Run this code
data(colon)
fit <- dcsvm(colon$x, colon$y, lam2=1)
print(predict(fit, type="class", newx=colon$x[2:5, ]))

Run the code above in your browser using DataLab