Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFeature Request - Constraining Covariates #1
Comments
|
@michaelwhammer -- that's a very good suggestion -- as I'm going to make more important vanilla glmnet/ncvreg arguments available for msaenet, this one could have a high priority. |
|
Additionally, if it's possible to enable a |
|
-- that is a very good point. I guess there is a certain balance between the flexibility and clarity for the API design:
After these, we can consider adding more flexibility -- |
|
@michaelwhammer -- this has been fixed by 5e10777. The new version (v2.6) has been submitted to CRAN. In the same time, you can try the GitHub version using devtools::install_github("road2stat/msaenet")Here is some code for testing: library("msaenet")
dat = msaenet.sim.gaussian(
n = 150, p = 500, rho = 0.6,
coef = rep(2, 5), snr = 5, p.train = 0.7,
seed = 1001)
fit0 = msaenet(
dat$x.tr, dat$y.tr,
alphas = seq(0.05, 0.95, 0.05),
nsteps = 3L, seed = 1003)
print(fit0)
msaenet.nzv(fit0)
msaenet.fp(fit0, 1:5)
msaenet.tp(fit0, 1:5)
msaenet.pred = predict(fit0, dat$x.te)
msaenet.rmse(dat$y.te, msaenet.pred)
plot(fit0)
fit1 = msaenet(
dat$x.tr, dat$y.tr,
alphas = seq(0.05, 0.95, 0.05),
nsteps = 3L, lower.limits = 0L,
seed = 1003)
print(fit1)
msaenet.nzv(fit1)
msaenet.fp(fit1, 1:5)
msaenet.tp(fit1, 1:5)
msaenet.pred = predict(fit1, dat$x.te)
msaenet.rmse(dat$y.te, msaenet.pred)
plot(fit1)Please feel free to let me know if it does not work as expected. Thanks! -Nan |
It would be useful if the functions in this package supported or provided arguments similar to
glmnet::glmnet()'slower.limitsandupper.limits. I frequently run adaptive elastic nets usingglmnetand regularly have to constrain covariates to be non-negative or non-positive.