#' @param ncores Number of cores, by default = 3
#' @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
#'
#' @export
constructionModelesLassoRank <- function(S, k, mini, maxi, X, Y, eps, rank.min, rank.max,
- ncores, fast = TRUE, verbose = FALSE)
+ ncores, fast, verbose)
{
- n <- dim(X)[1]
- p <- dim(X)[2]
- m <- dim(Y)[2]
+ n <- nrow(X)
+ p <- ncol(X)
+ m <- ncol(Y)
L <- length(S)
# Possible interesting ranks
for (j in 1:p)
{
if (length(selected[[j]]) > 0)
- {
relevant <- c(relevant, j)
- }
}
if (max(rankIndex) < length(relevant))
{
{
res <- EMGrank(S[[lambdaIndex]]$Pi, S[[lambdaIndex]]$Rho, mini, maxi,
X[, relevant], Y, eps, rankIndex, fast)
- llh <- c(res$LLF, sum(rankIndex * (length(relevant) - rankIndex +
- m)))
+ llh <- c(res$LLF, sum(rankIndex * (length(relevant) - rankIndex + m)))
phi[relevant, , ] <- res$phi
}
list(llh = llh, phi = phi, pi = S[[lambdaIndex]]$Pi, rho = S[[lambdaIndex]]$Rho)
-
}
}
# For each lambda in the grid we compute the estimators
- out <- if (ncores > 1) {
- parLapply(cl, seq_len(length(S) * Size), computeAtLambda) } else {
- lapply(seq_len(length(S) * Size), computeAtLambda)
+ out <-
+ if (ncores > 1) {
+ parLapply(cl, seq_len(length(S) * Size), computeAtLambda)
+ } else {
+ lapply(seq_len(length(S) * Size), computeAtLambda)
+ }
if (ncores > 1)
parallel::stopCluster(cl)