From: Benjamin Auder Date: Wed, 5 Apr 2017 16:21:49 +0000 (+0200) Subject: add verbose possibility in sub-functions X-Git-Url: https://git.auder.net/images/assets/js/img/current/%3C?a=commitdiff_plain;h=b9b0b72a2c8f7f0d1a3216528aefcec0a92c6c99;p=valse.git add verbose possibility in sub-functions --- diff --git a/pkg/R/EMGLLF_R.R b/pkg/R/EMGLLF_R.R index 039e291..227d803 100644 --- a/pkg/R/EMGLLF_R.R +++ b/pkg/R/EMGLLF_R.R @@ -150,7 +150,7 @@ EMGLLF_R = function(phiInit,rhoInit,piInit,gamInit,mini,maxi,gamma,lambda,X,Y,ta ite = ite+1 } - + affec = apply(gam, 1, which.max) return(list("phi"=phi, "rho"=rho, "pi"=pi, "LLF"=LLF, "S"=S, "affec" = affec )) } diff --git a/pkg/R/constructionModelesLassoMLE.R b/pkg/R/constructionModelesLassoMLE.R index e8013a2..06d552d 100644 --- a/pkg/R/constructionModelesLassoMLE.R +++ b/pkg/R/constructionModelesLassoMLE.R @@ -12,7 +12,7 @@ constructionModelesLassoMLE = function(phiInit, rhoInit, piInit, gamInit, mini, { if (ncores > 1) { - cl = parallel::makeCluster(ncores) + cl = parallel::makeCluster(ncores, outfile='') parallel::clusterExport( cl, envir=environment(), varlist=c("phiInit","rhoInit","gamInit","mini","maxi","gamma","X","Y","thresh", "tau","S","ncores","verbose") ) @@ -69,8 +69,8 @@ constructionModelesLassoMLE = function(phiInit, rhoInit, piInit, gamInit, mini, out = if (ncores > 1) parLapply(cl, 1:length(S), computeAtLambda) - else - lapply(1:length(S), computeAtLambda) + else + lapply(1:length(S), computeAtLambda) if (ncores > 1) parallel::stopCluster(cl) diff --git a/pkg/R/constructionModelesLassoRank.R b/pkg/R/constructionModelesLassoRank.R index 71713f7..6dbf350 100644 --- a/pkg/R/constructionModelesLassoRank.R +++ b/pkg/R/constructionModelesLassoRank.R @@ -35,7 +35,7 @@ constructionModelesLassoRank = function(pi, rho, mini, maxi, X, Y, tau, A1, rang if (ncores > 1) { - cl = parallel::makeCluster(ncores) + cl = parallel::makeCluster(ncores, outfile='') parallel::clusterExport( cl, envir=environment(), varlist=c("A1","Size","Pi","Rho","mini","maxi","X","Y","tau", "Rank","m","phi","ncores","verbose") ) diff --git a/pkg/R/main.R b/pkg/R/main.R index bff2ec5..93f8e3f 100644 --- a/pkg/R/main.R +++ b/pkg/R/main.R @@ -106,7 +106,7 @@ valse = function(X, Y, procedure='LassoMLE', selecMod='DDSE', gamma=1, mini=10, #Pour un groupe de modeles (même k, différents lambda): llh = matrix(ncol = 2) for (l in seq_along(models)) - llh = rbind(llh, models[[l]]$llh) + llh = rbind(llh, models[[l]]$llh) #TODO: LLF? harmonize between EMGLLF and EMGrank? LLH = llh[-1,1] D = llh[-1,2] k = length(models[[1]]$pi) @@ -115,7 +115,7 @@ valse = function(X, Y, procedure='LassoMLE', selecMod='DDSE', gamma=1, mini=10, tableauRecap = tableauRecap[rowSums(tableauRecap[, 2:4])!=0,] tableauRecap = tableauRecap[(tableauRecap[,1])!=Inf,] data = cbind(1:dim(tableauRecap)[1], tableauRecap[,2], tableauRecap[,2], tableauRecap[,1]) - +browser() modSel = capushe::capushe(data, n) indModSel <- if (selecMod == 'DDSE') diff --git a/pkg/R/selectVariables.R b/pkg/R/selectVariables.R index 54eda38..4e9b374 100644 --- a/pkg/R/selectVariables.R +++ b/pkg/R/selectVariables.R @@ -27,7 +27,7 @@ selectVariables = function(phiInit,rhoInit,piInit,gamInit,mini,maxi,gamma,glambd { if (ncores > 1) { - cl = parallel::makeCluster(ncores) + cl = parallel::makeCluster(ncores, outfile='') parallel::clusterExport(cl=cl, varlist=c("phiInit","rhoInit","gamInit","mini","maxi","glambda","X","Y","thresh","tau"), envir=environment())