Skip to contents

Prints a compact description of the fitted base learner, including the learner type, the time-grid used, and (optionally) the fitted model object for a given cause.

Usage

# S3 method for class 'base_learner'
print(x, cause = 1, ...)

Arguments

x

base_learner object returned by fit_learner().

cause

numeric(1) or NULL. Which cause to print the fitted model for. If NULL, prints one line per cause (classes only) instead of printing the full fitted objects.

...

Passed to the underlying fitted object print() method when cause is a single integer.

Value

Invisibly returns x.

Examples

d <- simulateStenoT1(30, competing_risks = TRUE)
lrn <- Learner_glmnet(
  covariates = c("sex", "value_LDL"),
  lambda = 0.01,
  cross_validation = FALSE
)
bl <- fit_learner(
  d,
  learner = lrn,
  id = "id",
  status = "status_cvd",
  event_time = "time_cvd",
  number_of_nodes = 3
)
print(bl, cause = NULL)
#> 
#> Call:  (function (x, y, family = c("gaussian", "binomial", "poisson",      "multinomial", "cox", "mgaussian"), weights = NULL, offset = NULL,      alpha = 1, nlambda = 100, lambda.min.ratio = ifelse(nobs <          nvars, 0.01, 1e-04), lambda = NULL, standardize = TRUE,      intercept = TRUE, thresh = 1e-07, dfmax = NULL, pmax = NULL,      exclude = NULL, penalty.factor = rep(1, nvars), lower.limits = -Inf,      upper.limits = Inf, maxit = 1e+05, type.gaussian = ifelse(nvars <          500, "covariance", "naive"), type.logistic = c("Newton",          "modified.Newton"), standardize.response = FALSE, type.multinomial = c("ungrouped",          "grouped"), relax = FALSE, trace.it = 0, cox.ties = c("breslow",          "efron"), control = list(), ...)  {     this.call = match.call()     cox.ties.user <- !missing(cox.ties)     np = dim(x)     if (is.null(np) | (np[2] <= 1))          stop("x should be a matrix with 2 or more columns")     nobs = as.integer(np[1])     nvars = as.integer(np[2])     if (any(is.na(x)))          stop("x has missing values; consider using makeX() to impute them")     rc <- .resolve_control(control = control, nvars = nvars,          deprecated = list(thresh = if (!missing(thresh)) thresh,              maxit = if (!missing(maxit)) maxit, dfmax = if (!missing(dfmax)) dfmax,              pmax = if (!missing(pmax)) pmax, trace.it = if (!missing(trace.it)) trace.it))     resolved_control <- rc$control     if (!is.null(rc$restore))          on.exit(rc$restore(), add = TRUE)     thresh <- resolved_control$thresh     maxit <- resolved_control$maxit     dfmax <- resolved_control$dfmax     pmax <- resolved_control$pmax     trace.it <- resolved_control$trace.it     if (is.null(weights))          weights = rep(1, nobs)     else if (length(weights) != nobs)          stop(paste("number of elements in weights (", length(weights),              ") not equal to the number of rows of x (", nobs,              ")", sep = ""))     if (is.function(exclude))          exclude <- check.exclude(exclude(x = x, y = y, weights = weights),              nvars)     if (is.function(penalty.factor))          penalty.factor <- penalty.factor(x = x, y = y, weights = weights)     penalty.factor <- check.penalty.factor(penalty.factor, nvars)     if (!is.character(family)) {         fit = glmnet.path(x, y, weights = weights, lambda = lambda,              nlambda = nlambda, lambda.min.ratio = lambda.min.ratio,              alpha = alpha, offset = offset, family = family,              standardize = standardize, intercept = intercept,              penalty.factor = penalty.factor, exclude = exclude,              lower.limits = lower.limits, upper.limits = upper.limits,              control = resolved_control)         fit$call = this.call     }     else {         family = match.arg(family)         cox.ties = match.arg(cox.ties)         if (family == "cox" && !cox.ties.user) {             warning("Starting in glmnet 5.1, the default Cox tie-handling ",                  "method will change from 'breslow' to 'efron' (matching ",                  "survival::coxph). To silence this message and lock in the ",                  "v5.0 default, pass cox.ties = 'breslow' explicitly. To ",                  "preview the v5.1 behavior, pass cox.ties = 'efron'.",                  call. = FALSE)         }         efron = (cox.ties == "efron")         if (FALSE) {         }         else {             if (alpha > 1) {                 warning("alpha >1; set to 1")                 alpha = 1             }             if (alpha < 0) {                 warning("alpha<0; set to 0")                 alpha = 0             }             alpha = as.double(alpha)             nlam = as.integer(nlambda)             y = drop(y)             dimy = dim(y)             nrowy = ifelse(is.null(dimy), length(y), dimy[1])             if (nrowy != nobs)                  stop(paste("number of observations in y (", nrowy,                    ") not equal to the number of rows of x (",                    nobs, ")", sep = ""))             vnames = colnames(x)             if (is.null(vnames))                  vnames = paste("V", seq(nvars), sep = "")             ne = as.integer(dfmax)             nx = as.integer(pmax)             if (is.null(exclude))                  exclude = integer(0)             if (any(penalty.factor == Inf)) {                 exclude = c(exclude, seq(nvars)[penalty.factor ==                    Inf])                 exclude = sort(unique(exclude))             }             if (length(exclude) > 0) {                 jd = match(exclude, seq(nvars), 0)                 if (!all(jd > 0))                    stop("Some excluded variables out of range")                 penalty.factor[jd] = 1                 jd = as.integer(c(length(jd), jd))             }             else jd = as.integer(0)             vp = as.double(penalty.factor)             if (trace.it && !resolved_control$itrace) {                 glmnet.control(itrace = 1)                 on.exit(glmnet.control(itrace = 0), add = TRUE)             }             if (any(lower.limits > 0)) {                 stop("Lower limits should be non-positive")             }             if (any(upper.limits < 0)) {                 stop("Upper limits should be non-negative")             }             lower.limits[lower.limits == -Inf] = -resolved_control$big             upper.limits[upper.limits == Inf] = resolved_control$big             if (length(lower.limits) < nvars) {                 if (length(lower.limits) == 1)                    lower.limits = rep(lower.limits, nvars)                 else stop("Require length 1 or nvars lower.limits")             }             else lower.limits = lower.limits[seq(nvars)]             if (length(upper.limits) < nvars) {                 if (length(upper.limits) == 1)                    upper.limits = rep(upper.limits, nvars)                 else stop("Require length 1 or nvars upper.limits")             }             else upper.limits = upper.limits[seq(nvars)]             cl = rbind(lower.limits, upper.limits)             if (any(cl == 0)) {                 fdev = resolved_control$fdev                 if (fdev != 0) {                   glmnet.control(fdev = 0)                   on.exit(glmnet.control(fdev = fdev), add = TRUE)                 }             }             storage.mode(cl) = "double"             isd = as.integer(standardize)             intr = as.integer(intercept)             if (!missing(intercept) && family == "cox")                  warning("Cox model has no intercept")             jsd = as.integer(standardize.response)             thresh = as.double(thresh)             if (is.null(lambda)) {                 if (lambda.min.ratio >= 1)                    stop("lambda.min.ratio should be less than 1")                 flmin = as.double(lambda.min.ratio)                 ulam = double(1)             }             else {                 flmin = as.double(1)                 if (any(lambda < 0))                    stop("lambdas should be non-negative")                 ulam = as.double(rev(sort(lambda)))                 nlam = as.integer(length(lambda))             }             is.sparse = FALSE             if (inherits(x, "sparseMatrix")) {                 is.sparse = TRUE                 if (!inherits(x, "dgCMatrix"))                    x = as(as(as(x, "generalMatrix"), "CsparseMatrix"),                      "dMatrix")             }             else if (!inherits(x, "matrix")) {                 x <- data.matrix(x)             }             else {                 x <- x             }             if (!inherits(x, "sparseMatrix")) {                 storage.mode(x) <- "double"             }             if (trace.it) {                 if (relax)                    cat("Training Fit\n")                 pb <- createPB(min = 0, max = nlam, initial = 0,                    style = 3)             }             else {                 pb <- NULL             }             kopt = switch(match.arg(type.logistic), Newton = 0,                  modified.Newton = 1)             if (family == "multinomial") {                 type.multinomial = match.arg(type.multinomial)                 if (type.multinomial == "grouped")                    kopt = 2             }             kopt = as.integer(kopt)             fit = switch(family, gaussian = elnet(x, is.sparse,                  y, weights, offset, type.gaussian, alpha, nobs,                  nvars, jd, vp, cl, ne, nx, nlam, flmin, ulam,                  thresh, isd, intr, vnames, maxit, pb), poisson = fishnet(x,                  is.sparse, y, weights, offset, alpha, nobs, nvars,                  jd, vp, cl, ne, nx, nlam, flmin, ulam, thresh,                  isd, intr, vnames, maxit, pb), binomial = lognet(x,                  is.sparse, y, weights, offset, alpha, nobs, nvars,                  jd, vp, cl, ne, nx, nlam, flmin, ulam, thresh,                  isd, intr, vnames, maxit, kopt, family, pb),                  multinomial = lognet(x, is.sparse, y, weights,                    offset, alpha, nobs, nvars, jd, vp, cl, ne,                    nx, nlam, flmin, ulam, thresh, isd, intr, vnames,                    maxit, kopt, family, pb), cox = coxnet(x, is.sparse,                    y, weights, offset, alpha, nobs, nvars, jd,                    vp, cl, ne, nx, nlam, flmin, ulam, thresh,                    isd, vnames, maxit, pb, efron), mgaussian = mrelnet(x,                    is.sparse, y, weights, offset, alpha, nobs,                    nvars, jd, vp, cl, ne, nx, nlam, flmin, ulam,                    thresh, isd, jsd, intr, vnames, maxit, pb))             if (trace.it) {                 utils::setTxtProgressBar(pb, nlam)                 close(pb)             }             if (is.null(lambda))                  fit$lambda = fix.lam(fit$lambda)             fit$call = this.call             fit$nobs = nobs             class(fit) = c(class(fit), "glmnet")         }     }     if (relax)          relax.glmnet(fit, x = x, y = y, weights = weights, offset = offset,              lower.limits = lower.limits, upper.limits = upper.limits,              penalty.factor = penalty.factor, check.args = FALSE,              ...)     else fit })(x = new("dgCMatrix", i = c(0L, 3L, 4L, 5L, 6L, 13L, 14L, 15L,  16L, 17L, 18L, 25L, 26L, 27L, 31L, 32L, 33L, 37L, 38L, 39L, 40L,  41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 61L, 62L, 63L, 64L, 65L,  66L, 67L, 68L, 73L, 74L, 75L, 76L, 85L, 86L, 87L, 88L, 0L, 1L,  2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L,  16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L,  29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L,  42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L, 51L, 52L, 53L, 54L,  55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L, 63L, 64L, 65L, 66L, 67L,  68L, 69L, 70L, 71L, 72L, 73L, 74L, 75L, 76L, 77L, 78L, 79L, 80L,  81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L, 2L, 4L, 6L, 8L, 10L,  12L, 14L, 16L, 18L, 20L, 23L, 26L, 29L, 32L, 35L, 38L, 41L, 44L,  47L, 50L, 54L, 58L, 62L, 66L, 70L, 74L, 78L, 82L, 86L, 21L, 24L,  27L, 30L, 33L, 36L, 39L, 42L, 45L, 48L, 51L, 55L, 59L, 63L, 67L,  71L, 75L, 79L, 83L, 87L, 52L, 56L, 60L, 64L, 68L, 72L, 76L, 80L,  84L, 88L), p = c(0L, 45L, 134L, 163L, 183L, 193L, 193L), Dim = c(89L,  6L), Dimnames = list(c("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", "39", "40", "41",  "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52",  "53", "54", "55", "56", "57", "58", "59", "60", "61", "62", "63",  "64", "65", "66", "67", "68", "69", "70", "71", "72", "73", "74",  "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85",  "86", "87", "88", "89"), c("sex1", "value_LDL", "noden2", "noden3",  "noden4", "noden5")), x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3.75113702973314, 1.96896348671084,  1.96896348671084, 3.19444441475125, 3.19444441475125, 3.35338653089683,  3.35338653089683, 2.91838033829596, 2.91838033829596, 1.14800918111279,  1.14800918111279, 2.40052867415048, 2.40052867415048, 2.27470856391387,  2.27470856391387, 2.61945764272373, 2.61945764272373, 3.70333915671442,  3.70333915671442, 1.31146768642795, 1.31146768642795, 1.31146768642795,  1.24899053984835, 1.24899053984835, 1.24899053984835, 3.7000560710817,  3.7000560710817, 3.7000560710817, 3.37801485750764, 3.37801485750764,  3.37801485750764, 2.61063895986695, 2.61063895986695, 2.61063895986695,  2.24223853989282, 2.24223853989282, 2.24223853989282, 1.42267575624826,  1.42267575624826, 1.42267575624826, 1.97769203467776, 1.97769203467776,  1.97769203467776, 1.8713537355373, 1.8713537355373, 1.8713537355373,  1.22433572211247, 1.22433572211247, 1.22433572211247, 2.32654594208734,  2.32654594208734, 2.32654594208734, 2.32654594208734, 2.8350904586317,  2.8350904586317, 2.8350904586317, 2.8350904586317, 2.16879414036456,  2.16879414036456, 2.16879414036456, 2.16879414036456, 0.609800496031174,  0.609800496031174, 0.609800496031174, 0.609800496031174, 1.7660400611433,  1.7660400611433, 1.7660400611433, 1.7660400611433, 2.08790894000342,  2.08790894000342, 2.08790894000342, 2.08790894000342, 3.17809437418561,  3.17809437418561, 3.17809437418561, 3.17809437418561, 2.04436395030194,  2.04436395030194, 2.04436395030194, 2.04436395030194, 3.07858724822404,  3.07858724822404, 3.07858724822404, 3.07858724822404, 2.83818194018515,  2.83818194018515, 2.83818194018515, 2.83818194018515, 1, 1, 1,  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), factors = list()),      y = c(1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1,      0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,      0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,      0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), family = "poisson",      offset = c(-2.24236513716394, -2.24236513716394, -1.03256988159489,      -2.24236513716394, -0.484314147990968, -2.24236513716394,      0.880761940622377, -2.24236513716394, 1.0934998969951, -2.24236513716394,      1.19010716592462, -2.24236513716394, 1.20744263390279, -2.24236513716394,      1.26306453432275, -2.24236513716394, 1.28253525158156, -2.24236513716394,      1.74776927527718, -2.24236513716394, 1.74776927527718, -1.61354556937815,      -2.24236513716394, 1.74776927527718, -1.20932445118175, -2.24236513716394,      1.74776927527718, 0.0341880282768864, -2.24236513716394,      1.74776927527718, 0.0859551662021467, -2.24236513716394,      1.74776927527718, 0.537428636102455, -2.24236513716394, 1.74776927527718,      0.573503709141078, -2.24236513716394, 1.74776927527718, 0.643309202578801,      -2.24236513716394, 1.74776927527718, 0.714882728058492, -2.24236513716394,      1.74776927527718, 0.970503733706702, -2.24236513716394, 1.74776927527718,      1.14425729130492, -2.24236513716394, 1.74776927527718, 1.14425729130492,      -1.76009447152746, -2.24236513716394, 1.74776927527718, 1.14425729130492,      -0.549425453433788, -2.24236513716394, 1.74776927527718,      1.14425729130492, 0.190617559071275, -2.24236513716394, 1.74776927527718,      1.14425729130492, 0.74784744709797, -2.24236513716394, 1.74776927527718,      1.14425729130492, 1.08594381011609, -2.24236513716394, 1.74776927527718,      1.14425729130492, 1.21764030365622, -2.24236513716394, 1.74776927527718,      1.14425729130492, 1.29687399430634, -2.24236513716394, 1.74776927527718,      1.14425729130492, 1.52379935570823, -2.24236513716394, 1.74776927527718,      1.14425729130492, 1.65520793420484, -2.24236513716394, 1.74776927527718,      1.14425729130492, 1.75112696449948), lambda = 0.01, intercept = TRUE) 
#> 
#>   Df %Dev Lambda
#> 1  3 3.77   0.01
#> 
#> Call:  (function (x, y, family = c("gaussian", "binomial", "poisson",      "multinomial", "cox", "mgaussian"), weights = NULL, offset = NULL,      alpha = 1, nlambda = 100, lambda.min.ratio = ifelse(nobs <          nvars, 0.01, 1e-04), lambda = NULL, standardize = TRUE,      intercept = TRUE, thresh = 1e-07, dfmax = NULL, pmax = NULL,      exclude = NULL, penalty.factor = rep(1, nvars), lower.limits = -Inf,      upper.limits = Inf, maxit = 1e+05, type.gaussian = ifelse(nvars <          500, "covariance", "naive"), type.logistic = c("Newton",          "modified.Newton"), standardize.response = FALSE, type.multinomial = c("ungrouped",          "grouped"), relax = FALSE, trace.it = 0, cox.ties = c("breslow",          "efron"), control = list(), ...)  {     this.call = match.call()     cox.ties.user <- !missing(cox.ties)     np = dim(x)     if (is.null(np) | (np[2] <= 1))          stop("x should be a matrix with 2 or more columns")     nobs = as.integer(np[1])     nvars = as.integer(np[2])     if (any(is.na(x)))          stop("x has missing values; consider using makeX() to impute them")     rc <- .resolve_control(control = control, nvars = nvars,          deprecated = list(thresh = if (!missing(thresh)) thresh,              maxit = if (!missing(maxit)) maxit, dfmax = if (!missing(dfmax)) dfmax,              pmax = if (!missing(pmax)) pmax, trace.it = if (!missing(trace.it)) trace.it))     resolved_control <- rc$control     if (!is.null(rc$restore))          on.exit(rc$restore(), add = TRUE)     thresh <- resolved_control$thresh     maxit <- resolved_control$maxit     dfmax <- resolved_control$dfmax     pmax <- resolved_control$pmax     trace.it <- resolved_control$trace.it     if (is.null(weights))          weights = rep(1, nobs)     else if (length(weights) != nobs)          stop(paste("number of elements in weights (", length(weights),              ") not equal to the number of rows of x (", nobs,              ")", sep = ""))     if (is.function(exclude))          exclude <- check.exclude(exclude(x = x, y = y, weights = weights),              nvars)     if (is.function(penalty.factor))          penalty.factor <- penalty.factor(x = x, y = y, weights = weights)     penalty.factor <- check.penalty.factor(penalty.factor, nvars)     if (!is.character(family)) {         fit = glmnet.path(x, y, weights = weights, lambda = lambda,              nlambda = nlambda, lambda.min.ratio = lambda.min.ratio,              alpha = alpha, offset = offset, family = family,              standardize = standardize, intercept = intercept,              penalty.factor = penalty.factor, exclude = exclude,              lower.limits = lower.limits, upper.limits = upper.limits,              control = resolved_control)         fit$call = this.call     }     else {         family = match.arg(family)         cox.ties = match.arg(cox.ties)         if (family == "cox" && !cox.ties.user) {             warning("Starting in glmnet 5.1, the default Cox tie-handling ",                  "method will change from 'breslow' to 'efron' (matching ",                  "survival::coxph). To silence this message and lock in the ",                  "v5.0 default, pass cox.ties = 'breslow' explicitly. To ",                  "preview the v5.1 behavior, pass cox.ties = 'efron'.",                  call. = FALSE)         }         efron = (cox.ties == "efron")         if (FALSE) {         }         else {             if (alpha > 1) {                 warning("alpha >1; set to 1")                 alpha = 1             }             if (alpha < 0) {                 warning("alpha<0; set to 0")                 alpha = 0             }             alpha = as.double(alpha)             nlam = as.integer(nlambda)             y = drop(y)             dimy = dim(y)             nrowy = ifelse(is.null(dimy), length(y), dimy[1])             if (nrowy != nobs)                  stop(paste("number of observations in y (", nrowy,                    ") not equal to the number of rows of x (",                    nobs, ")", sep = ""))             vnames = colnames(x)             if (is.null(vnames))                  vnames = paste("V", seq(nvars), sep = "")             ne = as.integer(dfmax)             nx = as.integer(pmax)             if (is.null(exclude))                  exclude = integer(0)             if (any(penalty.factor == Inf)) {                 exclude = c(exclude, seq(nvars)[penalty.factor ==                    Inf])                 exclude = sort(unique(exclude))             }             if (length(exclude) > 0) {                 jd = match(exclude, seq(nvars), 0)                 if (!all(jd > 0))                    stop("Some excluded variables out of range")                 penalty.factor[jd] = 1                 jd = as.integer(c(length(jd), jd))             }             else jd = as.integer(0)             vp = as.double(penalty.factor)             if (trace.it && !resolved_control$itrace) {                 glmnet.control(itrace = 1)                 on.exit(glmnet.control(itrace = 0), add = TRUE)             }             if (any(lower.limits > 0)) {                 stop("Lower limits should be non-positive")             }             if (any(upper.limits < 0)) {                 stop("Upper limits should be non-negative")             }             lower.limits[lower.limits == -Inf] = -resolved_control$big             upper.limits[upper.limits == Inf] = resolved_control$big             if (length(lower.limits) < nvars) {                 if (length(lower.limits) == 1)                    lower.limits = rep(lower.limits, nvars)                 else stop("Require length 1 or nvars lower.limits")             }             else lower.limits = lower.limits[seq(nvars)]             if (length(upper.limits) < nvars) {                 if (length(upper.limits) == 1)                    upper.limits = rep(upper.limits, nvars)                 else stop("Require length 1 or nvars upper.limits")             }             else upper.limits = upper.limits[seq(nvars)]             cl = rbind(lower.limits, upper.limits)             if (any(cl == 0)) {                 fdev = resolved_control$fdev                 if (fdev != 0) {                   glmnet.control(fdev = 0)                   on.exit(glmnet.control(fdev = fdev), add = TRUE)                 }             }             storage.mode(cl) = "double"             isd = as.integer(standardize)             intr = as.integer(intercept)             if (!missing(intercept) && family == "cox")                  warning("Cox model has no intercept")             jsd = as.integer(standardize.response)             thresh = as.double(thresh)             if (is.null(lambda)) {                 if (lambda.min.ratio >= 1)                    stop("lambda.min.ratio should be less than 1")                 flmin = as.double(lambda.min.ratio)                 ulam = double(1)             }             else {                 flmin = as.double(1)                 if (any(lambda < 0))                    stop("lambdas should be non-negative")                 ulam = as.double(rev(sort(lambda)))                 nlam = as.integer(length(lambda))             }             is.sparse = FALSE             if (inherits(x, "sparseMatrix")) {                 is.sparse = TRUE                 if (!inherits(x, "dgCMatrix"))                    x = as(as(as(x, "generalMatrix"), "CsparseMatrix"),                      "dMatrix")             }             else if (!inherits(x, "matrix")) {                 x <- data.matrix(x)             }             else {                 x <- x             }             if (!inherits(x, "sparseMatrix")) {                 storage.mode(x) <- "double"             }             if (trace.it) {                 if (relax)                    cat("Training Fit\n")                 pb <- createPB(min = 0, max = nlam, initial = 0,                    style = 3)             }             else {                 pb <- NULL             }             kopt = switch(match.arg(type.logistic), Newton = 0,                  modified.Newton = 1)             if (family == "multinomial") {                 type.multinomial = match.arg(type.multinomial)                 if (type.multinomial == "grouped")                    kopt = 2             }             kopt = as.integer(kopt)             fit = switch(family, gaussian = elnet(x, is.sparse,                  y, weights, offset, type.gaussian, alpha, nobs,                  nvars, jd, vp, cl, ne, nx, nlam, flmin, ulam,                  thresh, isd, intr, vnames, maxit, pb), poisson = fishnet(x,                  is.sparse, y, weights, offset, alpha, nobs, nvars,                  jd, vp, cl, ne, nx, nlam, flmin, ulam, thresh,                  isd, intr, vnames, maxit, pb), binomial = lognet(x,                  is.sparse, y, weights, offset, alpha, nobs, nvars,                  jd, vp, cl, ne, nx, nlam, flmin, ulam, thresh,                  isd, intr, vnames, maxit, kopt, family, pb),                  multinomial = lognet(x, is.sparse, y, weights,                    offset, alpha, nobs, nvars, jd, vp, cl, ne,                    nx, nlam, flmin, ulam, thresh, isd, intr, vnames,                    maxit, kopt, family, pb), cox = coxnet(x, is.sparse,                    y, weights, offset, alpha, nobs, nvars, jd,                    vp, cl, ne, nx, nlam, flmin, ulam, thresh,                    isd, vnames, maxit, pb, efron), mgaussian = mrelnet(x,                    is.sparse, y, weights, offset, alpha, nobs,                    nvars, jd, vp, cl, ne, nx, nlam, flmin, ulam,                    thresh, isd, jsd, intr, vnames, maxit, pb))             if (trace.it) {                 utils::setTxtProgressBar(pb, nlam)                 close(pb)             }             if (is.null(lambda))                  fit$lambda = fix.lam(fit$lambda)             fit$call = this.call             fit$nobs = nobs             class(fit) = c(class(fit), "glmnet")         }     }     if (relax)          relax.glmnet(fit, x = x, y = y, weights = weights, offset = offset,              lower.limits = lower.limits, upper.limits = upper.limits,              penalty.factor = penalty.factor, check.args = FALSE,              ...)     else fit })(x = new("dgCMatrix", i = c(0L, 3L, 4L, 5L, 6L, 13L, 14L, 15L,  16L, 17L, 18L, 25L, 26L, 27L, 31L, 32L, 33L, 37L, 38L, 39L, 40L,  41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 61L, 62L, 63L, 64L, 65L,  66L, 67L, 68L, 73L, 74L, 75L, 76L, 85L, 86L, 87L, 88L, 0L, 1L,  2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L,  16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L,  29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L,  42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L, 51L, 52L, 53L, 54L,  55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L, 63L, 64L, 65L, 66L, 67L,  68L, 69L, 70L, 71L, 72L, 73L, 74L, 75L, 76L, 77L, 78L, 79L, 80L,  81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L, 2L, 4L, 6L, 8L, 10L,  12L, 14L, 16L, 18L, 20L, 23L, 26L, 29L, 32L, 35L, 38L, 41L, 44L,  47L, 50L, 54L, 58L, 62L, 66L, 70L, 74L, 78L, 82L, 86L, 21L, 24L,  27L, 30L, 33L, 36L, 39L, 42L, 45L, 48L, 51L, 55L, 59L, 63L, 67L,  71L, 75L, 79L, 83L, 87L, 52L, 56L, 60L, 64L, 68L, 72L, 76L, 80L,  84L, 88L), p = c(0L, 45L, 134L, 163L, 183L, 193L, 193L), Dim = c(89L,  6L), Dimnames = list(c("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", "39", "40", "41",  "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52",  "53", "54", "55", "56", "57", "58", "59", "60", "61", "62", "63",  "64", "65", "66", "67", "68", "69", "70", "71", "72", "73", "74",  "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85",  "86", "87", "88", "89"), c("sex1", "value_LDL", "noden2", "noden3",  "noden4", "noden5")), x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3.75113702973314, 1.96896348671084,  1.96896348671084, 3.19444441475125, 3.19444441475125, 3.35338653089683,  3.35338653089683, 2.91838033829596, 2.91838033829596, 1.14800918111279,  1.14800918111279, 2.40052867415048, 2.40052867415048, 2.27470856391387,  2.27470856391387, 2.61945764272373, 2.61945764272373, 3.70333915671442,  3.70333915671442, 1.31146768642795, 1.31146768642795, 1.31146768642795,  1.24899053984835, 1.24899053984835, 1.24899053984835, 3.7000560710817,  3.7000560710817, 3.7000560710817, 3.37801485750764, 3.37801485750764,  3.37801485750764, 2.61063895986695, 2.61063895986695, 2.61063895986695,  2.24223853989282, 2.24223853989282, 2.24223853989282, 1.42267575624826,  1.42267575624826, 1.42267575624826, 1.97769203467776, 1.97769203467776,  1.97769203467776, 1.8713537355373, 1.8713537355373, 1.8713537355373,  1.22433572211247, 1.22433572211247, 1.22433572211247, 2.32654594208734,  2.32654594208734, 2.32654594208734, 2.32654594208734, 2.8350904586317,  2.8350904586317, 2.8350904586317, 2.8350904586317, 2.16879414036456,  2.16879414036456, 2.16879414036456, 2.16879414036456, 0.609800496031174,  0.609800496031174, 0.609800496031174, 0.609800496031174, 1.7660400611433,  1.7660400611433, 1.7660400611433, 1.7660400611433, 2.08790894000342,  2.08790894000342, 2.08790894000342, 2.08790894000342, 3.17809437418561,  3.17809437418561, 3.17809437418561, 3.17809437418561, 2.04436395030194,  2.04436395030194, 2.04436395030194, 2.04436395030194, 3.07858724822404,  3.07858724822404, 3.07858724822404, 3.07858724822404, 2.83818194018515,  2.83818194018515, 2.83818194018515, 2.83818194018515, 1, 1, 1,  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), factors = list()),      y = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), family = "poisson",      offset = c(-2.24236513716394, -2.24236513716394, -1.03256988159489,      -2.24236513716394, -0.484314147990968, -2.24236513716394,      0.880761940622377, -2.24236513716394, 1.0934998969951, -2.24236513716394,      1.19010716592462, -2.24236513716394, 1.20744263390279, -2.24236513716394,      1.26306453432275, -2.24236513716394, 1.28253525158156, -2.24236513716394,      1.74776927527718, -2.24236513716394, 1.74776927527718, -1.61354556937815,      -2.24236513716394, 1.74776927527718, -1.20932445118175, -2.24236513716394,      1.74776927527718, 0.0341880282768864, -2.24236513716394,      1.74776927527718, 0.0859551662021467, -2.24236513716394,      1.74776927527718, 0.537428636102455, -2.24236513716394, 1.74776927527718,      0.573503709141078, -2.24236513716394, 1.74776927527718, 0.643309202578801,      -2.24236513716394, 1.74776927527718, 0.714882728058492, -2.24236513716394,      1.74776927527718, 0.970503733706702, -2.24236513716394, 1.74776927527718,      1.14425729130492, -2.24236513716394, 1.74776927527718, 1.14425729130492,      -1.76009447152746, -2.24236513716394, 1.74776927527718, 1.14425729130492,      -0.549425453433788, -2.24236513716394, 1.74776927527718,      1.14425729130492, 0.190617559071275, -2.24236513716394, 1.74776927527718,      1.14425729130492, 0.74784744709797, -2.24236513716394, 1.74776927527718,      1.14425729130492, 1.08594381011609, -2.24236513716394, 1.74776927527718,      1.14425729130492, 1.21764030365622, -2.24236513716394, 1.74776927527718,      1.14425729130492, 1.29687399430634, -2.24236513716394, 1.74776927527718,      1.14425729130492, 1.52379935570823, -2.24236513716394, 1.74776927527718,      1.14425729130492, 1.65520793420484, -2.24236513716394, 1.74776927527718,      1.14425729130492, 1.75112696449948), lambda = 0.01, intercept = TRUE) 
#> 
#>   Df  %Dev Lambda
#> 1  2 41.45   0.01