Description Usage Arguments Value See Also Examples
View source: R/SparseSVM_solver.R
Solve given Sparse SVM problem in parametric simplex method
1 | SparseSVM_solver(X, y, max_it = 50, lambda_threshold = 0.01)
|
X |
|
y |
|
max_it |
This is the number of the maximum path length one would like to achieve. The default length is |
lambda_threshold |
The parametric simplex method will stop when the calculated parameter is smaller than lambda. The default value is |
An object with S3 class "primal"
is returned:
data |
The |
response |
The length |
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 |
type |
The type of the problem, such as |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.