add verbose possibility in sub-functions
authorBenjamin Auder <benjamin.auder@somewhere>
Wed, 5 Apr 2017 16:21:49 +0000 (18:21 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Wed, 5 Apr 2017 16:21:49 +0000 (18:21 +0200)
pkg/R/EMGLLF_R.R
pkg/R/constructionModelesLassoMLE.R
pkg/R/constructionModelesLassoRank.R
pkg/R/main.R
pkg/R/selectVariables.R

index 039e291..227d803 100644 (file)
@@ -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 ))
 }
index e8013a2..06d552d 100644 (file)
@@ -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)
index 71713f7..6dbf350 100644 (file)
@@ -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") )
index bff2ec5..93f8e3f 100644 (file)
@@ -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')
index 54eda38..4e9b374 100644 (file)
@@ -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())