| 1 | source("helper.R") |
| 2 | library(valse) |
| 3 | |
| 4 | generateRunSaveTest_EMGLLF = function(n=200, p=15, m=10, k=3, mini=5, maxi=10, gamma=1., lambda=0.5, eps=1e-6) |
| 5 | { |
| 6 | testFolder = "./data/" |
| 7 | dir.create(testFolder, showWarnings=FALSE, mode="0755") |
| 8 | |
| 9 | params = basicInitParameters(n, p, m, k) |
| 10 | xy = generateXYdefault(n, p, m, k) |
| 11 | |
| 12 | #save inputs |
| 13 | write.table(as.double(params$phiInit), paste(testFolder,"phiInit",sep=""), |
| 14 | row.names=F, col.names=F) |
| 15 | write.table(as.double(params$rhoInit), paste(testFolder,"rhoInit",sep=""), |
| 16 | row.names=F, col.names=F) |
| 17 | write.table(as.double(params$piInit), paste(testFolder,"piInit",sep=""), |
| 18 | row.names=F, col.names=F) |
| 19 | write.table(as.double(params$gamInit), paste(testFolder,"gamInit",sep=""), |
| 20 | row.names=F, col.names=F) |
| 21 | write.table(as.integer(mini), paste(testFolder,"mini",sep=""), |
| 22 | row.names=F, col.names=F) |
| 23 | write.table(as.integer(maxi), paste(testFolder,"maxi",sep=""), |
| 24 | row.names=F, col.names=F) |
| 25 | write.table(as.double(gamma), paste(testFolder,"gamma",sep=""), |
| 26 | row.names=F, col.names=F) |
| 27 | write.table(as.double(lambda), paste(testFolder,"lambda",sep=""), |
| 28 | row.names=F, col.names=F) |
| 29 | write.table(as.double(xy$X), paste(testFolder,"X",sep=""), |
| 30 | row.names=F, col.names=F) |
| 31 | write.table(as.double(xy$Y), paste(testFolder,"Y",sep=""), |
| 32 | row.names=F, col.names=F) |
| 33 | write.table(as.double(eps), paste(testFolder,"eps",sep=""), |
| 34 | row.names=F, col.names=F) |
| 35 | write.table(as.integer(c(n,p,m,k)), paste(testFolder,"dimensions",sep=""), |
| 36 | row.names=F, col.names=F) |
| 37 | |
| 38 | res = valse::EMGLLF(params$phiInit,params$rhoInit,params$piInit,params$gamInit,mini, |
| 39 | maxi,gamma,lambda,xy$X,xy$Y,eps,fast=FALSE) |
| 40 | |
| 41 | #save outputs |
| 42 | write.table(as.double(res$phi),paste(testFolder,"phi",sep=""),row.names=F,col.names=F) |
| 43 | write.table(as.double(res$rho),paste(testFolder,"rho",sep=""),row.names=F,col.names=F) |
| 44 | write.table(as.double(res$pi),paste(testFolder,"pi",sep=""),row.names=F,col.names=F) |
| 45 | write.table(as.double(res$llh),paste(testFolder,"llh",sep=""),row.names=F,col.names=F) |
| 46 | write.table(as.double(res$S),paste(testFolder,"S",sep=""),row.names=F,col.names=F) |
| 47 | write.table(as.integer(res$affec),paste(testFolder,"affec",sep=""),row.names=F,col.names=F) |
| 48 | } |