Commit | Line | Data |
---|---|---|
3f145e9a BG |
1 | constructionModelesLassoRank = function(Pi,Rho,mini,maxi,X,Y,tau,A1,rangmin,rangmax){ |
2 | #get matrix sizes | |
3 | n = dim(X)[1] | |
4 | p = dim(X)[2] | |
5 | m = dim(rho)[2] | |
6 | k = dim(rho)[3] | |
7 | L = dim(A1)[2] | |
8 | ||
9 | deltaRank = rangmax - rangmin + 1 | |
10 | Size = deltaRank^k | |
11 | Rank = matrix(0, Size, k) | |
9ade3f1b BA |
12 | # for(r in 1:k) { |
13 | # Rank[,r] = rangmin + <--- #FIXME: | |
14 | # } | |
3f145e9a BG |
15 | |
16 | phi = array(0, dim=c(p,m,k,L*Size)) | |
c3bc4705 | 17 | llh = matrix(0, L*Size, 2) #log-likelihood |
3f145e9a BG |
18 | for(lambdaIndex in 1:L){ |
19 | #on ne garde que les colonnes actives | |
20 | #active sera l'ensemble des variables informatives | |
21 | active = A1[, lambdaIndex] | |
22 | active[active==0] = c() | |
23 | if(length(active)>0){ | |
24 | for(j in 1:Size){ | |
25 | EMG_rank = EMGrank(Pi[,lambdaIndex], Rho[,,,lambdaIndex], mini, maxi, X[, active], Y, tau, Rank[j,]) | |
26 | phiLambda = EMG_rank$phi | |
27 | LLF = EMG_rank$LLF | |
c3bc4705 | 28 | llh[(lambdaIndex-1)*Size+j,] = c(LLF, sum(Rank[j,]^(length(active)- Rank[j,]+m))) |
3f145e9a BG |
29 | phi[active,,,(lambdaIndex-1)*Size+j] = phiLambda |
30 | } | |
31 | } | |
32 | } | |
c3bc4705 | 33 | return(list(phi=phi, llh = llh)) |
9ade3f1b | 34 | } |