From 74988d8f1311c2ad0505d53047c70e6c66042ba5 Mon Sep 17 00:00:00 2001 From: Meghana Madhyastha Date: Mon, 1 Jun 2020 02:51:22 +0000 Subject: [PATCH 1/2] Fix minor bug in BIC MClust --- R-Project/R/UrerfHelperFunctions.R | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/R-Project/R/UrerfHelperFunctions.R b/R-Project/R/UrerfHelperFunctions.R index efedb8ab..d544fd6e 100644 --- a/R-Project/R/UrerfHelperFunctions.R +++ b/R-Project/R/UrerfHelperFunctions.R @@ -137,13 +137,12 @@ BICCutMclust <- function(X) { X_2 <- X_data[mod1$classification == 2, ] X_2_sorted <- sort(X_2) - if (nrow(X_1) == 0) { - return(NULL) - } - if (nrow(X_2) == 0) { - return(NULL) - } - + if(is.null(X_1)) + return(NULL) + + if(is.null(X_2)) + return(NULL) + # Determine the cutpoint cutpt1 <- tail(X_1_sorted, n = 1) cutpt2 <- tail(X_2_sorted, n = 1) From 214866f291ee5c861c3b915a6da3cdec23d812a6 Mon Sep 17 00:00:00 2001 From: Meghana Madhyastha Date: Tue, 2 Jun 2020 01:22:11 +0000 Subject: [PATCH 2/2] Minor bug fix: Add null check in BICFast. --- R-Project/R/UrerfHelperFunctions.R | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/R-Project/R/UrerfHelperFunctions.R b/R-Project/R/UrerfHelperFunctions.R index d544fd6e..102204a4 100644 --- a/R-Project/R/UrerfHelperFunctions.R +++ b/R-Project/R/UrerfHelperFunctions.R @@ -12,6 +12,13 @@ BICCutFast <- function(X) { minVal <- min(X) maxVal <- max(X) + + if(is.null(minVal) || is.nan(minVal) || !is.finite(minVal)) + return(NULL) + + if(is.null(maxVal) || is.nan(maxVal) || !is.finite(maxVal)) + return(NULL) + minErr <- Inf finalvartype <- 0 otherBIC <- 0