From: Benjamin Auder Date: Fri, 10 Feb 2017 14:13:49 +0000 (+0100) Subject: fix valse pkg functions callings in src/test/generate X-Git-Url: https://git.auder.net/assets/css/current/doc/%24%7BgetWhatsApp%28link%29%7D?a=commitdiff_plain;h=9ade3f1b66fa07ad9f1a3b09fc05462c783841de;p=valse.git fix valse pkg functions callings in src/test/generate --- diff --git a/R/vec_bin.R b/R/vec_bin.R index ece7280..27f771b 100644 --- a/R/vec_bin.R +++ b/R/vec_bin.R @@ -20,4 +20,4 @@ vec_bin = function(X,r) Z[i] = 0 } return (list(Z=Z,indice=indice)) -} \ No newline at end of file +} diff --git a/src/test/generate_test_data/generateRunSaveTest_EMGLLF.R b/src/test/generate_test_data/generateRunSaveTest_EMGLLF.R index 60ac6c5..2c2dc2a 100644 --- a/src/test/generate_test_data/generateRunSaveTest_EMGLLF.R +++ b/src/test/generate_test_data/generateRunSaveTest_EMGLLF.R @@ -6,7 +6,8 @@ generateRunSaveTest_EMGLLF = function(n=200, p=15, m=10, k=3, mini=5, maxi=10, delimiter = " " #save inputs - params = basicInitParameters(n, p, m, k) + require(valse) + params = valse:::basic_Init_Parameters(n, p, m, k) io = generateIOdefault(n, p, m, k) write.table(paste(testFolder,"phiInit",sep=""), params$phiInit, sep=delimiter); write.table(paste(testFolder,"rhoInit",sep=""), params$rhoInit, sep=delimiter); diff --git a/src/test/generate_test_data/generateRunSaveTest_EMGrank.R b/src/test/generate_test_data/generateRunSaveTest_EMGrank.R index 6fc812a..0f97995 100644 --- a/src/test/generate_test_data/generateRunSaveTest_EMGrank.R +++ b/src/test/generate_test_data/generateRunSaveTest_EMGrank.R @@ -13,7 +13,8 @@ generateRunSaveTest_EMGrank = function(n=200, p=15, m=10, k=3, mini=5, maxi=10, } #Generate X and Y - generateIOdef = generateIOdefault(n, p, m, k) + require(valse) + generateIOdef = valse:::generateIOdefault(n, p, m, k) #save inputs write.table(paste(testFolder,"rho",sep=""), rho, sep=delimiter) diff --git a/src/test/generate_test_data/generateRunSaveTest_constructionModelesLassoMLE.R b/src/test/generate_test_data/generateRunSaveTest_constructionModelesLassoMLE.R index 104cb3f..b6ff68c 100644 --- a/src/test/generate_test_data/generateRunSaveTest_constructionModelesLassoMLE.R +++ b/src/test/generate_test_data/generateRunSaveTest_constructionModelesLassoMLE.R @@ -4,7 +4,8 @@ generateRunSaveTest_constructionModelesLassoMLE = function(n=200, p=15, m=10, k= delimiter = " " #Generate phiInit,piInit,... - params = basicInitParameters(n, p, m, k) + require(valse) + params = valse:::basic_Init_Parameters(n, p, m, k) #save inputs write.table(paste(testFolder,"phiInit",sep=""), params$phiInit, sep=delimiter) diff --git a/src/test/generate_test_data/generateRunSaveTest_constructionModelesLassoRank.R b/src/test/generate_test_data/generateRunSaveTest_constructionModelesLassoRank.R index 09d9823..dfb2736 100644 --- a/src/test/generate_test_data/generateRunSaveTest_constructionModelesLassoRank.R +++ b/src/test/generate_test_data/generateRunSaveTest_constructionModelesLassoRank.R @@ -17,7 +17,8 @@ generateRunSaveTest_constructionModelesLassoRank = function(n=200, p=15, m=10, L } } #Generate X and Y - generateIOdef = generateIOdefault(n, p, m, k) + require(valse) + generateIOdef = valse:::generateIOdefault(n, p, m, k) A1 = matrix(0,p,L) for(i in 1:L){ @@ -42,4 +43,4 @@ generateRunSaveTest_constructionModelesLassoRank = function(n=200, p=15, m=10, L write.table(paste(testFolder,"phi",sep=""), construct$phi, sep=delimiter) write.table(paste(testFolder,"lvraisemblance",sep=""), construct$lvraisemblance, sep=delimiter) -} \ No newline at end of file +} diff --git a/src/test/generate_test_data/generateRunSaveTest_selectiontotale.R b/src/test/generate_test_data/generateRunSaveTest_selectiontotale.R index b366ec9..adfe26c 100644 --- a/src/test/generate_test_data/generateRunSaveTest_selectiontotale.R +++ b/src/test/generate_test_data/generateRunSaveTest_selectiontotale.R @@ -3,11 +3,13 @@ generateRunSaveTest_selectiontotale= function(n=200, p=15, m=10, k=3, mini=5, ma dir.create(testFolder, showWarnings=FALSE, mode="0755") delimiter = " " + require(valse) + #Generate phiInit,piInit,... - params = basicInitParameters(n, p, m, k) + params = valse:::basic_Init_Parameters(n, p, m, k) #Generate X and Y - generateIOdef = generateIOdefault(n, p, m, k) + generateIOdef = valse:::generateIOdefault(n, p, m, k) #save inputs write.table(paste(testFolder,"phiInit",sep=""), params$phiInit, sep=delimiter) diff --git a/src/test/generate_test_data/helpers/EMGrank.R b/src/test/generate_test_data/helpers/EMGrank.R index e34e0be..a1e3df7 100644 --- a/src/test/generate_test_data/helpers/EMGrank.R +++ b/src/test/generate_test_data/helpers/EMGrank.R @@ -1,4 +1,3 @@ -source("/home/goehry/Documents/valse/valse/R/vec_bin.R") require(MASS) EMGrank = function(Pi, Rho, mini, maxi, X, Y, tau, rank){ #matrix dimensions @@ -24,7 +23,7 @@ EMGrank = function(Pi, Rho, mini, maxi, X, Y, tau, rank){ while(ite<=mini || (ite<=maxi && sumDeltaPhi>tau)){ #M step: Mise à jour de Beta (et donc phi) for(r in 1:k){ - Z_bin = vec_bin(Z,r) + Z_bin = valse:::vec_bin(Z,r) Z_vec = Z_bin$vec #vecteur 0 et 1 aux endroits o? Z==r Z_indice = Z_bin$indice if(sum(Z_indice) == 0){ @@ -82,4 +81,4 @@ EMGrank = function(Pi, Rho, mini, maxi, X, Y, tau, rank){ } return(list(phi=phi, LLF=LLF)) -} \ No newline at end of file +} diff --git a/src/test/generate_test_data/helpers/constructionModelesLassoRank.R b/src/test/generate_test_data/helpers/constructionModelesLassoRank.R index c319c61..183a6d1 100644 --- a/src/test/generate_test_data/helpers/constructionModelesLassoRank.R +++ b/src/test/generate_test_data/helpers/constructionModelesLassoRank.R @@ -9,9 +9,9 @@ constructionModelesLassoRank = function(Pi,Rho,mini,maxi,X,Y,tau,A1,rangmin,rang deltaRank = rangmax - rangmin + 1 Size = deltaRank^k Rank = matrix(0, Size, k) - for(r in 1:k){ - Rank[,r] = rangmin + - } +# for(r in 1:k) { +# Rank[,r] = rangmin + <--- #FIXME: +# } phi = array(0, dim=c(p,m,k,L*Size)) lvraisemblance = matrix(0, L*Size, 2) @@ -31,4 +31,4 @@ constructionModelesLassoRank = function(Pi,Rho,mini,maxi,X,Y,tau,A1,rangmin,rang } } return(list(phi=phi, lvraisemblance = lvraisemblance)) -} \ No newline at end of file +}