SparseSVM_solver {PRIMAL}R Documentation

Solve given Sparse SVM problem in parametric simplex method

Description

Solve given Sparse SVM problem in parametric simplex method

Usage

SparseSVM_solver(X, y, max_it = 50, lambda_threshold = 0.01)

Arguments

X

x is an n by d data matrix

y

y is a length n response vector

max_it

This is the number of the maximum path length one would like to achieve. The default length is 50.

lambda_threshold

The parametric simplex method will stop when the calculated parameter is smaller than lambda. The default value is 0.01.

Value

An object with S3 class "primal" is returned:

data

The n by d data matrix from the input

response

The length n response vector from the input

beta

A matrix of regression estimates whose columns correspond to regularization parameters for parametric simplex method.

beta0

A vector of regression estimates whose index correspond to regularization parameters for parametric simplex method.

df

The degree of freecom (number of nonzero coefficients) along the solution path.

value

The sequence of optimal value of the object function corresponded to the sequence of lambda.

iterN

The number of iteration in the program.

lambda

The sequence of regularization parameters lambda obtained in the program.

type

The type of the problem, such as Dantzig and SparseSVM.

See Also

primal-package

Examples

## SparseSVM
## We set the X matrix to be normal random matrix and Y is a vector consists of -1 and 1
## with the number of iteration to be 1000.
## Generate the design matrix and coefficient vector
n = 200 # sample number
d = 100 # sample dimension
c = 0.5 # correlation parameter
s = 20  # support size of coefficient
set.seed(1024)
X = matrix(rnorm(n*d),n,d)+c*rnorm(n)
## Generate response and solve the solution path
Y <- sample(c(-1,1),n,replace = TRUE)
## Sparse SVM solved with parametric simplex method
fit.SVM = SparseSVM_solver(X, Y, max_it = 1000, lambda_threshold = 0.01)
## lambdas used
print(fit.SVM$lambda)
## Visualize the solution path
plot(fit.SVM)

[Package PRIMAL version 1.0.2 Index]