Skip to content

Commit

Permalink
Error check related to issue #419 was added
Browse files Browse the repository at this point in the history
  • Loading branch information
topepo committed Apr 13, 2017
1 parent 8d09280 commit 6876bb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion pkg/caret/R/trainControl.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@
#' classification models (along with predicted values) in each resample?
#' @param summaryFunction a function to compute performance metrics across
#' resamples. The arguments to the function should be the same as those in
#' \code{\link{defaultSummary}}.
#' \code{\link{defaultSummary}}. Note that it \code{method = "oob"} is used,
#' this option is ignored and a warning is issued.
#' @param selectionFunction the function used to select the optimal tuning
#' parameter. This can be a name of the function or the function itself. See
#' \code{\link{best}} for details and other options.
Expand Down Expand Up @@ -236,6 +237,11 @@ trainControl <- function(method = "boot",
}
if(!(search %in% c("grid", "random")))
stop("`search` should be either 'grid' or 'random'")
if(method == "oob" & any(names(match.call()) == "summaryFunction")) {
warning("Custom summary measures cannot be computed for out-of-baf resampling. ",
"This value of `summaryFunction` will be ignored.",
call. = FALSE)
}

list(method = method,
number = number,
Expand Down
3 changes: 2 additions & 1 deletion pkg/caret/man/trainControl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6876bb3

Please sign in to comment.