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

View source: R/p.dcsvm.R

predict.dcsvmR Documentation

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 class 'dcsvm'
predict(object, newx, s = NULL, type = c("class", "link"), ...)

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.

Value

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

See Also

coef.dcsvm

Examples

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


dcsvm documentation built on April 3, 2025, 10:27 p.m.