X-Git-Url: https://git.auder.net/?p=valse.git;a=blobdiff_plain;f=pkg%2FR%2FconstructionModelesLassoRank.R;h=a37a7a6b79ea4d7f6721daedf712774177bad6b6;hp=9df8168e6d6e55358a959f2c6d1de47fbf20c04a;hb=6af1d4897dbab92a7be05068e0e15823378965d9;hpb=0ba1b11c49d7b2a0cae493200793c1ba3fb8b8e7 diff --git a/pkg/R/constructionModelesLassoRank.R b/pkg/R/constructionModelesLassoRank.R index 9df8168..a37a7a6 100644 --- a/pkg/R/constructionModelesLassoRank.R +++ b/pkg/R/constructionModelesLassoRank.R @@ -15,7 +15,11 @@ #' @param fast TRUE to use compiled C code, FALSE for R code only #' @param verbose TRUE to show some execution traces #' -#' @return a list with several models, defined by phi, rho, pi, llh +#' @return a list with several models, defined by phi (the regression parameter reparametrized), +#' rho (the covariance parameter reparametrized), pi (the proportion parameter is the mixture model), llh +#' (the value of the loglikelihood function for this estimator on the training dataset). The list is given +#' for several levels of sparsity, given by several regularization parameters computed automatically, +#' and several ranks (between rank.min and rank.max). #' #' @export constructionModelesLassoRank <- function(S, k, mini, maxi, X, Y, eps, rank.min, rank.max, @@ -33,10 +37,10 @@ constructionModelesLassoRank <- function(S, k, mini, maxi, X, Y, eps, rank.min, for (r in 1:k) { # On veut le tableau de toutes les combinaisons de rangs possibles, et des - # lambdas Dans la première colonne : on répète (rank.max-rank.min)^(k-1) chaque - # chiffre : ça remplit la colonne Dans la deuxieme : on répète - # (rank.max-rank.min)^(k-2) chaque chiffre, et on fait ça (rank.max-rank.min)^2 - # fois ... Dans la dernière, on répète chaque chiffre une fois, et on fait ça + # lambdas Dans la premiere colonne : on repete (rank.max-rank.min)^(k-1) chaque + # chiffre : ca remplit la colonne Dans la deuxieme : on repete + # (rank.max-rank.min)^(k-2) chaque chiffre, et on fait ca (rank.max-rank.min)^2 + # fois ... Dans la derniere, on repete chaque chiffre une fois, et on fait ca # (rank.min-rank.max)^(k-1) fois. RankLambda[, r] <- rep(rank.min + rep(0:(deltaRank - 1), deltaRank^(r - 1), each = deltaRank^(k - r)), each = L) @@ -83,7 +87,7 @@ constructionModelesLassoRank <- function(S, k, mini, maxi, X, Y, eps, rank.min, # For each lambda in the grid we compute the estimators out <- if (ncores > 1) { - parLapply(cl, seq_len(length(S) * Size), computeAtLambda) + parallel::parLapply(cl, seq_len(length(S) * Size), computeAtLambda) } else { lapply(seq_len(length(S) * Size), computeAtLambda) }