fix dec.tree bug

This commit is contained in:
Hollos Roland 2022-01-04 14:29:49 +01:00
parent 9443961233
commit f96b6667cc

View File

@ -247,20 +247,21 @@ multiSiteCalib <- function(measurements,
results <- (rbind(res0,resultsSans0)) results <- (rbind(res0,resultsSans0))
write.csv(results,"result.csv") write.csv(results,"result.csv")
calibrationPar <- future::value(fut[[1]], stdout = FALSE, signal=FALSE)[["calibrationPar"]] calibrationPar <- future::value(fut[[1]], stdout = FALSE, signal=FALSE)[["calibrationPar"]]
browser()
if(!is.null(constraints)){ if(!is.null(constraints)){
notForTree <- c(seq(from = (length(calibrationPar)+1), length.out=3)) tryCatch({
notForTree <- c(notForTree,which(sapply(seq_along(calibrationPar),function(i){sd(results[,i])==0}))) notForTree <- c(seq(from = (length(calibrationPar)+1), length.out=3))
treeData <- results[,-notForTree] notForTree <- c(notForTree,which(sapply(seq_along(calibrationPar),function(i){sd(results[,i])==0})))
treeData["failType"] <- as.factor(results$failType) treeData <- results[,-notForTree]
if(ncol(treeData) > 4){ treeData["failType"] <- as.factor(results$failType)
rp <- rpart(failType ~ .,data=treeData,control=treeControl) if(ncol(treeData) > 4){
svg("treeplot.svg") rp <- rpart(failType ~ .,data=treeData,control=treeControl)
tryCatch(rpart.plot(rp), error = function(e){ svg("treeplot.svg")
print(e) rpart.plot(rp)
}) dev.off()
dev.off() }
} }, error = function(e){
print(e)
})
} }
origModOut <- future::value(fut[[1]], stdout = FALSE, signal=FALSE)[["origModOut"]] origModOut <- future::value(fut[[1]], stdout = FALSE, signal=FALSE)[["origModOut"]]
# Just single objective version TODO:Multiobjective # Just single objective version TODO:Multiobjective