This is a short code for studying admm for lasso.
#--------------------------- functions to be used ----------------------
## the main function f = g + h
f <- function(x, A, b, lambda){
1/2*norm(A %*% x - b, "2")^2 + lambda*sum(abs(x))
}
## smooth function g
g <- function(x, A, b){
1/2*norm(A %*% x - b, "2")^2
}
## proximal function of none smooth function h
prox_L1 <- function(x, lambda){
s

本文提供了一段简短的R代码,用于通过交替方向乘子法(ADMM)实现Lasso回归的求解过程,旨在帮助读者理解ADMM在Lasso正则化问题中的应用。
最低0.47元/天 解锁文章
831

被折叠的 条评论
为什么被折叠?



