nanxstats / msaenet

🧲 Multi-step adaptive estimation for reducing false positive selection in sparse regressions
https://nanx.me/msaenet/
GNU General Public License v3.0
13 stars 7 forks source link

question(coordinate descent) #12

Closed xingxingyanjing closed 6 months ago

xingxingyanjing commented 6 months ago

Hello,did the coordinate descent method be used to estimate the coefficients of elastic network and adaptive elastic network?

nanxstats commented 6 months ago

Yes, because that part of msaenet is built on the glmnet package. As I quote from their vignette:

The glmnet algorithms use cyclical coordinate descent, which successively optimizes the objective function over each parameter with others fixed, and cycles repeatedly until convergence. The package also makes use of the strong rules for efficient restriction of the active set. Due to highly efficient updates and techniques such as warm starts and active-set convergence, our algorithms can compute the solution path very quickly.

xingxingyanjing commented 6 months ago

Hello, thank you very much for your answer. I find this package quite useful for evaluating models against different criteria. In my opinion, I think this package could use more explanatory language, especially for people using it for the first time. For instance, I know msaenet is based on some other packages, but I'm not sure which algorithm from which package is being used. It's possible I just haven't found the corresponding documentation yet. Also, I still have a few confusion.

  1. Can Elastic-Net use msaenet's aenet? Then when the scale is set to 0 , can it? And I wonder if the coefficient path graph for Elastic-Net looks strange.
  2. Why can't the coefficient path graph show the corresponding feature names, only the indicators for non-zero variables? Maybe it's because indexing is relatively simple.
nanxstats commented 6 months ago
  1. For vanilla elastic-net, I'd just use glmnet::glmnet(alpha = ...) to get canonical results.

  2. Use label.vars in plot() to specify variable names. This is documented in plot.msaenet(). For example:

library("msaenet")

dat <- msaenet.sim.gaussian(
  n = 200, p = 500, rho = 0.6, snr = 2,
  coef = c(rnorm(3, 10, 5), rnorm(3, -10, 5)),
  p.train = 0.8,
  seed = 42
)

fit <- msaenet(
  dat$x.tr, dat$y.tr,
  alphas = seq(0.1, 0.9, 0.1),
  nsteps = 10L, tune.nsteps = "ebic",
  seed = 42
)

label <- grex:::grex_db$hgnc_symbol[seq_len(ncol(dat$x.tr))]
plot(fit, label = TRUE, label.vars = label)
plot(fit, type = "dotplot", label = TRUE, label.vars = label)

This gives

coef-path

dotplot

xingxingyanjing commented 6 months ago

In fact, I'm planning to work on elastic network and adaptive elastic network at the same time. I'll think of a solution and I really appreciate your help. Thank you!