Description Usage Arguments Value Author(s) References Examples
main function of SGL
1 |
data |
input data, x and y |
index |
index |
maxit |
maxit |
thresh |
threshold |
min.frac |
minfrac |
nlam |
number of lambdas |
gamma |
gamma |
standardize |
flag of standardization |
verbose |
verbose |
step |
step |
reset |
reset |
alpha |
alpha |
lambdas |
sequence of lambdas |
result of SGL
Noah Simon, Jerome Friedman, Trevor Hastie, and Rob Tibshirani
Simon, N., Friedman, J., Hastie T., and Tibshirani, R. (2011) A Sparse-Group Lasso, http://www-stat.stanford.edu/~nsimon/SGL.pdf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (data, index, maxit = 1000, thresh = 0.001, min.frac = 0.1,
nlam = 20, gamma = 0.8, standardize = TRUE, verbose = FALSE,
step = 1, reset = 10, alpha = 0.95, lambdas = NULL)
{
X.transform <- NULL
if (standardize == TRUE) {
X <- data$x
means <- apply(X, 2, mean)
X <- t(t(X) - means)
var <- apply(X, 2, function(x) (sqrt(sum(x^2))))
X <- t(t(X)/var)
data$x <- X
X.transform <- list(X.scale = var, X.means = means)
}
if (standardize == TRUE) {
intercept <- mean(data$y)
data$y <- data$y - intercept
}
Sol <- oneDim(data, index, thresh, inner.iter = maxit, outer.iter = maxit,
outer.thresh = thresh, min.frac = min.frac, nlam = nlam,
lambdas = lambdas, gamma = gamma, verbose = verbose,
step = step, reset = reset, alpha = alpha)
if (standardize == TRUE) {
Sol <- list(beta = Sol$beta, lambdas = Sol$lambdas, type = type,
intercept = intercept, X.transform = X.transform)
}
if (standardize == FALSE) {
Sol <- list(beta = Sol$beta, lambdas = Sol$lambdas, type = type,
X.transform = X.transform)
}
class(Sol) = "SGL"
return(Sol)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.