CompressedSensing_solver {PRIMAL} | R Documentation |
Solve given compressed sensing problem in parametric simplex method
Description
Solve given compressed sensing problem in parametric simplex method
Usage
CompressedSensing_solver(X, y, max_it = 50, lambda_threshold = 0.01)
Arguments
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 |
Value
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. |
df |
The degree of freedom (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 |
See Also
primal-package
, Dantzig_solver
Examples
## Compressed Sensing
## We set X to be standard normal random matrix and generate Y using gaussian noise.
## Generate the design matrix and coefficient vector
n = 100 # sample number
d = 250 # sample dimension
c = 0.5 # correlation parameter
s = 20 # support size of coefficient
set.seed(1024)
X = scale(matrix(rnorm(n*d),n,d)+c*rnorm(n))/sqrt(n-1)*sqrt(n)
beta = c(rnorm(s), rep(0, d-s))
## Generate response using Gaussian noise, and solve the solution path
noise = rnorm(n)
Y = X%*%beta + noise
## Compressed Sensing solved with parametric simplex method
fit.compressed = CompressedSensing_solver(X, Y, max_it = 100, lambda_threshold = 0.01)
###lambdas used
print(fit.compressed$lambda)
## number of nonzero coefficients for each lambda
print(fit.compressed$df)
## Visualize the solution path
plot(fit.compressed)