From f96b6667cc50687239000726d304a9d0a156b2be Mon Sep 17 00:00:00 2001 From: Hollos Roland Date: Tue, 4 Jan 2022 14:29:49 +0100 Subject: [PATCH] fix dec.tree bug --- RBBGCMuso/R/multiSite.R | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/RBBGCMuso/R/multiSite.R b/RBBGCMuso/R/multiSite.R index bee1320..4fd7c9f 100644 --- a/RBBGCMuso/R/multiSite.R +++ b/RBBGCMuso/R/multiSite.R @@ -247,20 +247,21 @@ multiSiteCalib <- function(measurements, results <- (rbind(res0,resultsSans0)) write.csv(results,"result.csv") calibrationPar <- future::value(fut[[1]], stdout = FALSE, signal=FALSE)[["calibrationPar"]] - browser() if(!is.null(constraints)){ - notForTree <- c(seq(from = (length(calibrationPar)+1), length.out=3)) - notForTree <- c(notForTree,which(sapply(seq_along(calibrationPar),function(i){sd(results[,i])==0}))) - treeData <- results[,-notForTree] - treeData["failType"] <- as.factor(results$failType) - if(ncol(treeData) > 4){ - rp <- rpart(failType ~ .,data=treeData,control=treeControl) - svg("treeplot.svg") - tryCatch(rpart.plot(rp), error = function(e){ - print(e) - }) - dev.off() - } + tryCatch({ + notForTree <- c(seq(from = (length(calibrationPar)+1), length.out=3)) + notForTree <- c(notForTree,which(sapply(seq_along(calibrationPar),function(i){sd(results[,i])==0}))) + treeData <- results[,-notForTree] + treeData["failType"] <- as.factor(results$failType) + if(ncol(treeData) > 4){ + rp <- rpart(failType ~ .,data=treeData,control=treeControl) + svg("treeplot.svg") + rpart.plot(rp) + dev.off() + } + }, error = function(e){ + print(e) + }) } origModOut <- future::value(fut[[1]], stdout = FALSE, signal=FALSE)[["origModOut"]] # Just single objective version TODO:Multiobjective