From: Benjamin Goehry Date: Tue, 17 Jan 2017 08:37:32 +0000 (+0100) Subject: construction lasso rank X-Git-Url: https://git.auder.net/variants/Chakart/css/assets/doc/pieces/%7B%7B%20pkg.url%20%7D%7D?a=commitdiff_plain;h=3f145e9ad99f7e4b264215e3e5b648922f67f7b6;p=valse.git construction lasso rank --- diff --git a/src/test/generate_test_data/helpers/constructionModelesLassoRank.R b/src/test/generate_test_data/helpers/constructionModelesLassoRank.R new file mode 100644 index 0000000..c319c61 --- /dev/null +++ b/src/test/generate_test_data/helpers/constructionModelesLassoRank.R @@ -0,0 +1,34 @@ +constructionModelesLassoRank = function(Pi,Rho,mini,maxi,X,Y,tau,A1,rangmin,rangmax){ + #get matrix sizes + n = dim(X)[1] + p = dim(X)[2] + m = dim(rho)[2] + k = dim(rho)[3] + L = dim(A1)[2] + + deltaRank = rangmax - rangmin + 1 + Size = deltaRank^k + Rank = matrix(0, Size, k) + for(r in 1:k){ + Rank[,r] = rangmin + + } + + phi = array(0, dim=c(p,m,k,L*Size)) + lvraisemblance = matrix(0, L*Size, 2) + for(lambdaIndex in 1:L){ + #on ne garde que les colonnes actives + #active sera l'ensemble des variables informatives + active = A1[, lambdaIndex] + active[active==0] = c() + if(length(active)>0){ + for(j in 1:Size){ + EMG_rank = EMGrank(Pi[,lambdaIndex], Rho[,,,lambdaIndex], mini, maxi, X[, active], Y, tau, Rank[j,]) + phiLambda = EMG_rank$phi + LLF = EMG_rank$LLF + lvraisemblance[(lambdaIndex-1)*Size+j,] = c(LLF, sum(Rank[j,]^(length(active)- Rank[j,]+m))) + phi[active,,,(lambdaIndex-1)*Size+j] = phiLambda + } + } + } + return(list(phi=phi, lvraisemblance = lvraisemblance)) +} \ No newline at end of file