Skip to content

Commit

Permalink
OOB training is now reproducible if done in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
asardaes committed Jan 19, 2016
1 parent aa665b9 commit ee15ecb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/caret/R/train.default.R
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ train.default <- function(x, y,
} else trainInfo <- list(loop = tuneGrid)


num_rs <- length(trControl$index)
num_rs <- if(trControl$method != "oob") length(trControl$index) else 1L
if(trControl$method == "boot632") num_rs <- num_rs + 1L
## Set or check the seeds when needed
if(is.null(trControl$seeds) || all(is.na(trControl$seeds))) {
Expand Down
2 changes: 2 additions & 0 deletions pkg/caret/R/workflows.R
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ oobTrainWorkflow <- function(x, y, wts, info, method, ppOpts, ctrl, lev, testing
loadNamespace("caret")
if(ctrl$verboseIter) progress(printed[parm,,drop = FALSE], "", 1, TRUE)

if(!(length(ctrl$seeds) == 1 && is.na(ctrl$seeds))) set.seed(ctrl$seeds[[1L]][parm])

mod <- createModel(x = x,
y = y,
wts = wts,
Expand Down

0 comments on commit ee15ecb

Please sign in to comment.