coef.dcsvm: Compute Coefficients for Sparse Density-Convoluted SVM

View source: R/coef.dcsvm.R

coef.dcsvmR Documentation

Compute Coefficients for Sparse Density-Convoluted SVM

Description

Computes the coefficients or indices of nonzero coefficients at specified lambda values from a fitted dcsvm model.

Usage

## S3 method for class 'dcsvm'
coef(object, s = NULL, type = c("coefficients", "nonzero"), ...)

Arguments

object

A fitted dcsvm object.

s

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

type

"coefficients" or "nonzero"? "coefficients" computes the coefficients at given values for s; "nonzero" returns a list of the indices of the nonzero coefficients for each value of s. Default is "coefficients".

...

Not used. Other arguments to predict.

Details

Compute Coefficients for Sparse Density-Convoluted SVM

Computes the coefficients or returns the indices of nonzero coefficients at chosen values of lambda from a fitted dcsvm object.

s is the vector of lambda values at which predictions are requested. If s is not in the lambda sequence used for fitting the model, the coef function uses linear interpolation. The new values are interpolated using a fraction of coefficients from both left and right lambda indices.

Value

Either the coefficients at the requested values of lambda, or a list of the indices of the nonzero coefficients for each lambda.

See Also

predict.dcsvm

Examples

data(colon)
fit <- dcsvm(colon$x, colon$y, lam2=1)
c1 <- coef(fit, type="coefficients", s=c(0.1, 0.005))
c2 <- coef(fit, type="nonzero")


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