From b46623addc9e63019aa1df1dd2de800b48fdd609 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin@auder>
Date: Tue, 24 Sep 2019 09:52:23 +0200
Subject: [PATCH] Forgot to add weights as a field in Optimparams class

---
 pkg/R/optimParams.R    |  1 +
 reports/accuracy.R     |  6 ++++--
 reports/run_accu_cl.sh | 20 +++++++++-----------
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/pkg/R/optimParams.R b/pkg/R/optimParams.R
index 4f886ac..85c21e7 100644
--- a/pkg/R/optimParams.R
+++ b/pkg/R/optimParams.R
@@ -86,6 +86,7 @@ setRefClass(
 		M1 = "numeric", #order-1 moment (vector size d)
 		M2 = "numeric", #M2 easier to process as a vector
 		M3 = "numeric", #M3 easier to process as a vector
+		weights = "numeric", #weights on moments
 		# Dimensions
 		K = "integer",
 		d = "integer"
diff --git a/reports/accuracy.R b/reports/accuracy.R
index 05d9e8a..e9c9d1b 100644
--- a/reports/accuracy.R
+++ b/reports/accuracy.R
@@ -71,6 +71,7 @@ N <- 10
 d <- 2
 n <- 1e4
 ncores <- 1
+strw <- "1-1-1"
 weights <- c(1,1,1)
 
 cmd_args <- commandArgs()
@@ -89,7 +90,8 @@ for (arg in cmd_args)
 		} else if (spl[1] == "link") {
 			link <- spl[2]
 		} else if (spl[1] == "weights") {
-		  weights <- unlist(strsplit(spl[2], ","))
+			strw <- spl[2]
+		  weights <- as.numeric(unlist(strsplit(spl[2], ",")))
 		}
 	}
 }
@@ -120,4 +122,4 @@ mr <- optimBeta(N, n, K, p, beta, b, link, weights, ncores)
 mr_params <- list("N"=N, "n"=n, "K"=K, "d"=d, "link"=link,
 	"p"=c(p,1-sum(p)), "beta"=beta, "b"=b, "weights"=weights)
 
-save("mr", "mr_params", file=paste("multirun_",n,"_",d,"_",link,".RData",sep=""))
+save("mr", "mr_params", file=paste("res_",n,"_",d,"_",link,"_",strw,".RData",sep=""))
diff --git a/reports/run_accu_cl.sh b/reports/run_accu_cl.sh
index 6d6ac21..0cd877b 100644
--- a/reports/run_accu_cl.sh
+++ b/reports/run_accu_cl.sh
@@ -3,7 +3,7 @@
 #$ -N morpheus
 #$ -m abes
 #$ -M benjamin@auder.net
-#$ -pe make 5
+#$ -pe make 50
 #$ -l h_vmem=1G
 #$ -j y
 #$ -o .output
@@ -12,20 +12,18 @@ rm -f .output
 WORKDIR=/workdir2/auder/morpheus/reports
 cd $WORKDIR
 
-module load R/3.6.0
+module load R/3.6.1
 
-N=1000
+N=10
 n=1e5
 nc=50
 
-link=logit
-# and disable d=20 to run faster
-
-# arg --vanilla maybe possible on cluster
-for d in 2 5 10; do
-	#for link in "logit" "probit"; do
-		R --slave --args N=$N n=$n nc=$nc d=$d link=$link <accuracy.R >out_$n$link$d 2>&1
-	#done
+for d in 2 5 10 20; do
+	for link in "logit" "probit"; do
+		for weights in "1,1,1" "6,3,1"; do
+			R --slave --args N=$N n=$n nc=$nc d=$d link=$link weights=$weights <accuracy.R >out_${n}_${link}_${d}_${weights} 2>&1
+		done
+	done
 done
 
 #for d in 2 5; do
-- 
2.44.0