Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question on the oracle tuning because of the fact that sequences of lambda in the lasso method are different for each replication #14

Open
vtshen opened this issue Sep 1, 2018 · 0 comments

Comments

@vtshen
Copy link

vtshen commented Sep 1, 2018

In the simulation for the lasso method, for each replication, the lasso will generate a coefficient matrix according to a sequence of lambda of size = nlambda. Based on the coef.lasso function copied below, is it correct to say that the lambda sequences are different for each replication because lambda max is different after computing for each replication dataset?
Then if the sequences are different, it is OK for the validation tuning, because the validation tuning selects the optimal metric in each replication. But is it also okay for the oracle tuning? Since the oracle tuning selects the minimum err.test in the function choose.tuning.params, which relies on the storing of the metrics err.test in a matrix, which does not share the same column names, i.e., the lambda sequences.

coef.lasso.from.glmnet = function(object, s=NULL) {
  class(object) = "glmnet"
  if (length(object$lambda)==object$nlambda) {
    return(glmnet::coef.glmnet(object,s=s))
  }
  else {
    min.lam = min(object$lambda)
    max.lam = max(object$lambda)
    svec = exp(seq(log(max.lam),log(min.lam),length=object$nlambda))
    return(glmnet::coef.glmnet(object,s=svec))
    ## RJT TODO: should we used exact=TRUE above? Requires additional
    ## arguments to match the initial call to glmnet(), kind of clunky
    ## TH: use glmnet.control(fdev=0) at beginning of session
    ## Still needed though for cases when df exceeds p (can happen with
    ## glmnet, and bad for relaxed lasso)
  }
}
@vtshen vtshen changed the title Sequences of lambda in the lasso method are different Sequences of lambda in the lasso method are different for each replication Sep 1, 2018
@vtshen vtshen changed the title Sequences of lambda in the lasso method are different for each replication Question on the oracle tuning because of the fact that sequences of lambda in the lasso method are different for each replication Sep 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant