-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reproducibility #37
Reproducibility #37
Conversation
c36dfbe
to
be77774
Compare
res <- parLapply(cl = multiproc_cl, X = 1:K, fun = fn) | ||
# stopCluster(multiproc_cl) # replaced with on.exit() | ||
# | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting cleanup
y=dSet[!i,response]) | ||
y=dSet[!i,response], seed = seed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass seed
to downstream FUN
linters: linters_with_defaults(cyclocomp_linter = NULL, commented_code_linter = NULL, object_name_linter = NULL, line_length_linter = line_length_linter(length = 90L)) | ||
encoding: "UTF-8" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boilerplate static analysis setup
sel.alg=c("varSelRF","Boruta","top"), ...){ | ||
sel.alg=c("varSelRF","Boruta","top"), cores=NULL, | ||
seed=0, ...){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provided cores
and seed
options
Boruta = function(x,y) select_features_Boruta(x,y,...), | ||
Boruta = function(x,y, ...) select_features_Boruta(x,y,...), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enables seed to be passed to select_features_Boruta
.
top = select_features_top) | ||
|
||
# do K-fold split here | ||
if(is.null(K)) | ||
K <- nrow(dSet) | ||
num_rep <- ceiling(nrow(dSet)/K) | ||
set.seed(seed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set seed to determine cv_idx
.
R/rf_modeling.R
Outdated
RNGkind("L'Ecuyer-CMRG") | ||
set.seed(i) | ||
seed <- i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set random number generator kind and random seed in worker function by its index (i
).
clusterEvalQ(multiproc_cl, invisible(suppressWarnings({ | ||
Sys.setenv(`_R_S3_METHOD_REGISTRATION_NOTE_OVERWRITES_` = "false") | ||
suppressWarnings(suppressPackageStartupMessages({ | ||
library("MSnID") | ||
library("Biobase") | ||
})) | ||
}))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enable quiet evaluation of library loads
R/rf_modeling.R
Outdated
if(is.null(cores)){ | ||
cores <- max(1, detectCores() - 1) | ||
} | ||
stopifnot(1 <= cores) | ||
if(cores > detectCores()){ | ||
msg <- sub("\n", "", "The number of specified processes is greater than | ||
the number of cores available on this computer. | ||
This may lead to high computational overhead.") | ||
warning(msg) | ||
} | ||
multiproc_cl <- makeCluster(cores, outfile = "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automatic # of cores determination
To try out, use remotes::install_github("PNNL-Comp-Mass-Spec/MSnSet.utils", ref = "ben-reproducibility", force = TRUE) |
See Issue #36 for details.