Skip to contents

Minimises 1/2 ||Ax - b||^2 + lam * ||x||_1; the prox is soft-thresholding at lam * t, not at t.

Usage

lasso_fista(A, b, lam, max_iter = 500L, tol = 1e-10, accelerate = TRUE)

Arguments

A

Numeric matrix.

b

Numeric vector.

lam

Non-negative penalty.

max_iter

Integer, maximum iterations.

tol

Stop when the step is at most tol.

accelerate

If TRUE run FISTA, otherwise ISTA.

Value

A list with estimate, x, fun, objective, iterations, L, accelerated, converged, method, lambda, L.

Examples

set.seed(4)
A <- matrix(rnorm(100 * 5), 100, 5)
b <- A %*% c(2, 0, 0, -1, 0) + rnorm(100, sd = 0.1)
round(lasso_fista(A, as.numeric(b), lam = 5)$x, 3)
#> [1]  1.949  0.000  0.000 -0.922  0.000