From c877cd3f8e7ba93668f5a3a84649cca61a836905 Mon Sep 17 00:00:00 2001 From: bwilbertz Date: Sun, 17 Jan 2016 00:04:59 +0100 Subject: [PATCH] Restrict generation of. confusion matrix for resamples when number of classes is large --- pkg/caret/R/workflows.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/caret/R/workflows.R b/pkg/caret/R/workflows.R index db15cc856..262c6f857 100644 --- a/pkg/caret/R/workflows.R +++ b/pkg/caret/R/workflows.R @@ -274,7 +274,7 @@ nominalTrainWorkflow <- function(x, y, wts, info, method, ppOpts, ctrl, lev, tes model = method) if(testing) print(head(thisResample)) ## for classification, add the cell counts - if(length(lev) > 1) + if(length(lev) > 1 && length(lev) <= 50) { cells <- lapply(predicted, function(x) flatTable(x$pred, x$obs)) @@ -311,7 +311,7 @@ nominalTrainWorkflow <- function(x, y, wts, info, method, ppOpts, ctrl, lev, tes model = method) ## if classification, get the confusion matrix - if(length(lev) > 1) thisResample <- c(thisResample, flatTable(tmp$pred, tmp$obs)) + if(length(lev) > 1 && length(lev) <= 50) thisResample <- c(thisResample, flatTable(tmp$pred, tmp$obs)) thisResample <- as.data.frame(t(thisResample)) thisResample <- cbind(thisResample, info$loop[parm,,drop = FALSE])