FoygelDrton_Armadillo | R Documentation |
Minimize l2-penalized quadratic function
FoygelDrton_Armadillo(h, L, lambda, evals, evecs)
h |
a vector |
L |
a matrix with number of rows equal to the length of h |
lambda |
a value greater than zero giving the strength of the penalty |
evals |
the eigenvalues of L^TL |
evecs |
the eigenvectors of L^TL |
Returns the unique minimizer of
(1/2) \|h - L β\|_2^2 + λ * \|β\|_2
See Theorem 2 of Foygel, Rina, and Mathias Drton. "Exact block-wise optimization in group lasso and sparse group lasso for linear regression." arXiv preprint arXiv:1010.3320 (2010).
# generate an h and L h <- rnorm(100) L <- matrix(rnorm(100*10),100,10) lambda <- 1 # get eigendecomposition of t(L) %*% L LtL <- t(L) %*% L eigen.out <- eigen(LtL) evals <- eigen.out$values evecs <- t(eigen.out$vectors) # find minimizer FoygelDrton_Armadillo(h,L,lambda,evals,evecs) # compare to using optim() to minimize the same function obj <- function(beta,L,h,lambda){ val <- (1/2) * sum( (h - L %*% beta )^2 ) + lambda * sqrt( sum(beta^2)) return(val) } optim(par=rep(0,d),obj,L = L, h = h, lambda = lambda)$par
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.