fix generateRunTest for constructionModelesEMGrank; remove man pages (will be roxygen...
[valse.git] / src / test / generate_test_data / generateRunSaveTest_constructionModelesLassoRank.R
CommitLineData
ef67d338 1generateRunSaveTest_constructionModelesLassoRank = function(n=200, p=15, m=10, k=3, L=12, mini=5,
c3bc4705
BA
2 maxi=10, gamma=1.0, rangmin=3, rangmax=6)
3{
f1b906da 4 tau = 1e-6
ef67d338
BA
5 pi = matrix(1./k, nrow=k, ncol=L)
6 rho = array(dim=c(m,m,k,L))
7 for (l in 1:L)
8 {
9 for (r in 1:k)
f1b906da 10 rho[,,r,l] = diag(1,m)
f1b906da 11 }
ef67d338 12 A1 = matrix(seq_len(p), nrow=p, ncol=L)
9ade3f1b 13 require(valse)
ef67d338 14 xy = valse:::generateXYdefault(n, p, m, k)
c3bc4705 15
ef67d338
BA
16 testFolder = "data/"
17 dir.create(testFolder, showWarnings=FALSE, mode="0755")
f1b906da 18 #save inputs
c3bc4705
BA
19 write.table(as.double(pi), paste(testFolder,"pi",sep=""),
20 row.names=F, col.names=F)
ef67d338
BA
21 write.table(as.double(rho),paste(testFolder,"rho",sep=""),
22 row.names=F, col.names=F)
c3bc4705
BA
23 write.table(as.integer(mini), paste(testFolder,"mini",sep=""),
24 row.names=F, col.names=F)
25 write.table(as.integer(maxi), paste(testFolder,"maxi",sep=""),
26 row.names=F, col.names=F)
ef67d338 27 write.table(as.double(xy$X), paste(testFolder,"X",sep=""),
c3bc4705 28 row.names=F, col.names=F)
ef67d338 29 write.table(as.double(xy$Y), paste(testFolder,"Y",sep=""),
c3bc4705
BA
30 row.names=F, col.names=F)
31 write.table(as.double(tau),paste(testFolder,"tau",sep=""),
32 row.names=F, col.names=F)
33 write.table(as.double(A1),paste(testFolder,"A1",sep=""),
34 row.names=F, col.names=F)
35 write.table(as.integer(rangmin),paste(testFolder,"rangmin",sep=""),
36 row.names=F, col.names=F)
37 write.table(as.integer(rangmax),paste(testFolder,"rangmax",sep=""),
38 row.names=F, col.names=F)
ef67d338 39 write.table(as.integer(c(n,p,m,k,L)),paste(testFolder,"dimensions",sep=""),
c3bc4705
BA
40 row.names=F, col.names=F)
41
ef67d338 42 res = constructionModelesLassoRank(pi,rho,mini,maxi,xy$X,xy$Y,tau,A1,rangmin,rangmax)
c3bc4705 43
f1b906da 44 #save output
c3bc4705
BA
45 write.table(as.double(res$phi), paste(testFolder,"phi",sep=""), row.names=F, col.names=F)
46 write.table(as.double(res$llh), paste(testFolder,"llh",sep=""), row.names=F, col.names=F)
9ade3f1b 47}