correction emgrank.R
[valse.git] / src / test / generate_test_data / generateRunSaveTest_EMGLLF.R
1 generateRunSaveTest_EMGLLF = function(n=200, p=15, m=10, k=3, mini=5, maxi=10,
2 gamma=1., lambda=0.5, tau=1e-6)
3 {
4 testFolder = "data/"
5 dir.create(testFolder, showWarnings=FALSE, mode="0755")
6 delimiter = " "
7
8 #save inputs
9 params = basicInitParameters(n, p, m, k)
10 io = generateIOdefault(n, p, m, k)
11 write.table(paste(testFolder,"phiInit",sep=""), params$phiInit, sep=delimiter);
12 write.table(paste(testFolder,"rhoInit",sep=""), params$rhoInit, sep=delimiter);
13 write.table(paste(testFolder,"piInit",sep=""), params$piInit, sep=delimiter);
14 write.table(paste(testFolder,"gamInit",sep=""), params$gamInit, sep=delimiter);
15 write.table(paste(testFolder,"mini",sep=""), mini, sep=delimiter);
16 write.table(paste(testFolder,"maxi",sep=""), maxi, sep=delimiter);
17 write.table(paste(testFolder,"gamma",sep=""), gamma, sep=delimiter);
18 write.table(paste(testFolder,"lambda",sep=""), lambda, sep=delimiter);
19 write.table(paste(testFolder,"X",sep=""), io$X, sep=delimiter);
20 write.table(paste(testFolder,"Y",sep=""), io$Y, sep=delimiter);
21 write.table(paste(testFolder,"tau",sep=""), tau, sep=delimiter);
22 write.table(paste(testFolder,"dimensions",sep=""), c(n,p,m,k), sep=delimiter);
23
24 res = EMGLLF(params$phiInit,params$rhoInit,params$piInit,params$gamInit,mini,maxi,
25 gamma,lambda,io$X,io$Y,tau);
26
27 #save outputs
28 write.table(paste(testFolder,"phi",sep=""), res$phi, sep=delimiter);
29 write.table(paste(testFolder,"rho",sep=""), res$rho, sep=delimiter);
30 write.table(paste(testFolder,"pi",sep=""), res$pi, sep=delimiter);
31 write.table(paste(testFolder,"LLF",sep=""), res$LLF, sep=delimiter);
32 write.table(paste(testFolder,"S",sep=""), res$S, sep=delimiter);
33 }