X-Git-Url: https://git.auder.net/?p=valse.git;a=blobdiff_plain;f=R%2FselectVariables.R;fp=R%2FselectVariables.R;h=46fb3f33165106d2d4f3a91943b81ac7709b7b74;hp=03578c9d382fc867c92813e1f582c6a958da5f54;hb=07848d25af9f342f7d8e2dd103f2502d945afe54;hpb=621ec46ceb49d86ad3d525cfb263329f1d1faff8 diff --git a/R/selectVariables.R b/R/selectVariables.R index 03578c9..46fb3f3 100644 --- a/R/selectVariables.R +++ b/R/selectVariables.R @@ -21,17 +21,19 @@ #' @export selectVariables = function(phiInit,rhoInit,piInit,gamInit,mini,maxi,gamma,glambda,X,Y,seuil,tau) { + #TODO: parameter ncores (chaque tâche peut aussi demander du parallélisme...) cl = parallel::makeCluster( parallel::detectCores() / 4 ) parallel::clusterExport(cl=cl, varlist=c("phiInit","rhoInit","gamInit","mini","maxi","glambda","X","Y","seuil","tau"), envir=environment()) #Pour chaque lambda de la grille, on calcule les coefficients - out = parLapply( 1:L, function(lambdaindex) + out = parLapply( seq_along(glambda), function(lambdaindex) { - params = EMGLLF(phiInit,rhoInit,piInit,gamInit,mini,maxi,gamma,glambda[lambdaIndex],X,Y,tau) - p = dim(phiInit)[1] m = dim(phiInit)[2] + + params = EMGLLF(phiInit,rhoInit,piInit,gamInit,mini,maxi,gamma,glambda[lambdaIndex],X,Y,tau) + #selectedVariables: list where element j contains vector of selected variables in [1,m] selectedVariables = lapply(1:p, function(j) { #from boolean matrix mxk of selected variables obtain the corresponding boolean m-vector,