projects
/
valse.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
remove pre-commit hook; fix weird formatting from formatR package
[valse.git]
/
pkg
/
R
/
constructionModelesLassoRank.R
diff --git
a/pkg/R/constructionModelesLassoRank.R
b/pkg/R/constructionModelesLassoRank.R
index
dc6bcc1
..
5857a42
100644
(file)
--- a/
pkg/R/constructionModelesLassoRank.R
+++ b/
pkg/R/constructionModelesLassoRank.R
@@
-1,7
+1,7
@@
#' constructionModelesLassoRank
#'
#' Construct a collection of models with the Lasso-Rank procedure.
#' constructionModelesLassoRank
#'
#' Construct a collection of models with the Lasso-Rank procedure.
-#'
+#'
#' @param S output of selectVariables.R
#' @param k number of components
#' @param mini integer, minimum number of iterations in the EM algorithm, by default = 10
#' @param S output of selectVariables.R
#' @param k number of components
#' @param mini integer, minimum number of iterations in the EM algorithm, by default = 10
@@
-14,7
+14,7
@@
#' @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
#' @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
#' @return a list with several models, defined by phi, rho, pi, llh
#'
#' @export
@@
-64,9
+64,7
@@
constructionModelesLassoRank <- function(S, k, mini, maxi, X, Y, eps, rank.min,
for (j in 1:p)
{
if (length(selected[[j]]) > 0)
for (j in 1:p)
{
if (length(selected[[j]]) > 0)
- {
relevant <- c(relevant, j)
relevant <- c(relevant, j)
- }
}
if (max(rankIndex) < length(relevant))
{
}
if (max(rankIndex) < length(relevant))
{
@@
-75,19
+73,20
@@
constructionModelesLassoRank <- function(S, k, mini, maxi, X, Y, eps, rank.min,
{
res <- EMGrank(S[[lambdaIndex]]$Pi, S[[lambdaIndex]]$Rho, mini, maxi,
X[, relevant], Y, eps, rankIndex, fast)
{
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)
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
}
}
# 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)
if (ncores > 1)
parallel::stopCluster(cl)