From f805b3d9618a27d7d48fa5fc8083bab3c1d6b7e2 Mon Sep 17 00:00:00 2001 From: Benjamin Auder <benjamin@auder> Date: Mon, 16 Dec 2019 19:37:55 +0100 Subject: [PATCH] Refresh accuracy.R --- reports/accuracy.R | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/reports/accuracy.R b/reports/accuracy.R index 5eadd3b..ee08078 100644 --- a/reports/accuracy.R +++ b/reports/accuracy.R @@ -2,16 +2,14 @@ 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)), + list(n=n, p=p, beta=beta, b=b, K=K, link=link), list( # morpheus function(fargs) { library(morpheus) - K <- fargs$optargs$K - M <- computeMoments(fargs$X, fargs$Y) - fargs$optargs$M <- M - mu <- computeMu(fargs$X, fargs$Y, fargs$optargs) - op <- optimParams(K,fargs$optargs$link,fargs$optargs) + K <- fargs$K + mu <- computeMu(fargs$X, fargs$Y, list(K=K)) + op <- optimParams(fargs$X, fargs$Y, K, fargs$link) x_init <- list(p=rep(1/K,K-1), beta=mu, b=rep(0,K)) res2 <- NULL tryCatch({ @@ -24,7 +22,7 @@ optimBeta <- function(N, n, K, p, beta, b, link, ncores) # function(fargs) { # library(flexmix) # source("../patch_Bettina/FLXMRglm.R") -# K <- fargs$optargs$K +# K <- fargs$K # dat <- as.data.frame( cbind(fargs$Y,fargs$X) ) # res2 <- NULL # tryCatch({ @@ -44,10 +42,9 @@ optimBeta <- function(N, n, K, p, beta, b, link, ncores) ), prepareArgs = function(fargs, index) { library(morpheus) - io = generateSampleIO(fargs$n, fargs$p, fargs$beta, fargs$b, fargs$optargs$link) + io = generateSampleIO(fargs$n, fargs$p, fargs$beta, fargs$b, fargs$link) fargs$X = io$X fargs$Y = io$Y - fargs$optargs$K = ncol(fargs$beta) fargs }, N=N, ncores=ncores, verbose=TRUE) p <- c(p, 1-sum(p)) -- 2.44.0