X-Git-Url: https://git.auder.net/img/rock_paper_scissors_lizard_spock.gif?a=blobdiff_plain;f=reports%2Faccuracy.R;h=5eadd3bdf5ef0a5f17e96f9006b2634f401713e0;hb=074c721aa587d45c4f7ef10f8a28fdc09273d31a;hp=91d9c61634a34bf3e75d8e33b42d01e65b735781;hpb=0ad4c8de650e9f27ec3754c9cb9b2a03db5aff24;p=morpheus.git diff --git a/reports/accuracy.R b/reports/accuracy.R index 91d9c61..5eadd3b 100644 --- a/reports/accuracy.R +++ b/reports/accuracy.R @@ -1,8 +1,8 @@ -optimBeta <- function(N, n, K, p, beta, b, link, weights, ncores) +optimBeta <- function(N, n, K, p, beta, b, link, ncores) { library(morpheus) res <- multiRun( - list(n=n, p=p, beta=beta, b=b, optargs=list(K=K, link=link, weights=weights)), + list(n=n, p=p, beta=beta, b=b, optargs=list(K=K, link=link)), list( # morpheus function(fargs) { @@ -13,11 +13,10 @@ optimBeta <- function(N, n, K, p, beta, b, link, weights, ncores) mu <- computeMu(fargs$X, fargs$Y, fargs$optargs) op <- optimParams(K,fargs$optargs$link,fargs$optargs) x_init <- list(p=rep(1/K,K-1), beta=mu, b=rep(0,K)) + res2 <- NULL tryCatch({ res2 <- do.call(rbind, op$run(x_init)) - }, error = function(e) { - res2 <- NA - }) + }, error = function(e) {}) res2 } # , @@ -69,8 +68,6 @@ N <- 10 d <- 2 n <- 1e4 ncores <- 1 -strw <- "1-1-1" -weights <- c(1,1,1) cmd_args <- commandArgs() for (arg in cmd_args) @@ -87,9 +84,6 @@ for (arg in cmd_args) d <- as.integer(spl[2]) } else if (spl[1] == "link") { link <- spl[2] - } else if (spl[1] == "weights") { - strw <- spl[2] - weights <- as.numeric(unlist(strsplit(spl[2], ","))) } } } @@ -116,8 +110,8 @@ if (d == 2) { beta <- matrix( c(1,2,-1,0,3,4,-1,-3,0,2,2,-3,0,1,0,-1,-4,3,2,0, -1,1,3,-1,0,0,2,0,1,-2,1,2,-1,0,3,4,-1,-3,0,2, 2,-3,0,1,0,-1,-4,3,2,0,1,1,2,2,-2,-2,3,1,0,0), ncol=K ) } -mr <- optimBeta(N, n, K, p, beta, b, link, weights, ncores) +mr <- optimBeta(N, n, K, p, beta, b, link, ncores) mr_params <- list("N"=N, "nc"=ncores, "n"=n, "K"=K, "d"=d, "link"=link, - "p"=c(p,1-sum(p)), "beta"=beta, "b"=b, "weights"=weights) + "p"=c(p,1-sum(p)), "beta"=beta, "b"=b) -save("mr", "mr_params", file=paste("res_",n,"_",d,"_",link,"_",strw,".RData",sep="")) +save("mr", "mr_params", file=paste("res_",n,"_",d,"_",link,".RData",sep=""))