Skip to content

Commit

Permalink
add documentation for threads
Browse files Browse the repository at this point in the history
  • Loading branch information
mnwright committed Dec 6, 2023
1 parent 8ba5fe8 commit 553aa9a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
10 changes: 8 additions & 2 deletions R/predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
##'
##' For classification and \code{predict.all = TRUE}, a factor levels are returned as numerics.
##' To retrieve the corresponding factor levels, use \code{rf$forest$levels}, if \code{rf} is the ranger object.
##'
##' By default, ranger uses 2 threads. The default can be changed with: (1) \code{num.threads} in ranger/predict call, (2) environment variable
##' R_RANGER_NUM_THREADS, (3) \code{options(ranger.num.threads = N)}, (4) \code{options(Ncpus = N)}, with precedence in that order.
##'
##' @title Ranger prediction
##' @param object Ranger \code{ranger.forest} object.
Expand All @@ -45,7 +48,7 @@
##' @param type Type of prediction. One of 'response', 'se', 'terminalNodes', 'quantiles' with default 'response'. See below for details.
##' @param se.method Method to compute standard errors. One of 'jack', 'infjack' with default 'infjack'. Only applicable if type = 'se'. See below for details.
##' @param seed Random seed. Default is \code{NULL}, which generates the seed from \code{R}. Set to \code{0} to ignore the \code{R} seed. The seed is used in case of ties in classification mode.
##' @param num.threads Number of threads. Default is number of CPUs available.
##' @param num.threads Number of threads. Default is 2 if not set by options/environment variables (see below).
##' @param verbose Verbose output on or off.
##' @param inbag.counts Number of times the observations are in-bag in the trees.
##' @param ... further arguments passed to or from other methods.
Expand Down Expand Up @@ -433,6 +436,9 @@ predict.ranger.forest <- function(object, data, predict.all = FALSE,
##'
##' For classification and \code{predict.all = TRUE}, a factor levels are returned as numerics.
##' To retrieve the corresponding factor levels, use \code{rf$forest$levels}, if \code{rf} is the ranger object.
##'
##' By default, ranger uses 2 threads. The default can be changed with: (1) \code{num.threads} in ranger/predict call, (2) environment variable
##' R_RANGER_NUM_THREADS, (3) \code{options(ranger.num.threads = N)}, (4) \code{options(Ncpus = N)}, with precedence in that order.
##'
##' @title Ranger prediction
##' @param object Ranger \code{ranger} object.
Expand All @@ -444,7 +450,7 @@ predict.ranger.forest <- function(object, data, predict.all = FALSE,
##' @param quantiles Vector of quantiles for quantile prediction. Set \code{type = 'quantiles'} to use.
##' @param what User specified function for quantile prediction used instead of \code{quantile}. Must return numeric vector, see examples.
##' @param seed Random seed. Default is \code{NULL}, which generates the seed from \code{R}. Set to \code{0} to ignore the \code{R} seed. The seed is used in case of ties in classification mode.
##' @param num.threads Number of threads. Default is number of CPUs available.
##' @param num.threads Number of threads. Default is 2 if not set by options/environment variables (see below).
##' @param verbose Verbose output on or off.
##' @param ... further arguments passed to or from other methods.
##' @return Object of class \code{ranger.prediction} with elements
Expand Down
8 changes: 4 additions & 4 deletions R/ranger.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@
##' To use only the SNPs without sex or other covariates from the phenotype file, use \code{0} on the right hand side of the formula.
##' Note that missing values are treated as an extra category while splitting.
##'
##' See \url{https://github.com/imbs-hl/ranger} for the development version.
##' By default, ranger uses 2 threads. The default can be changed with: (1) \code{num.threads} in ranger/predict call, (2) environment variable
##' R_RANGER_NUM_THREADS, (3) \code{options(ranger.num.threads = N)}, (4) \code{options(Ncpus = N)}, with precedence in that order.
##'
##' With recent R versions, multithreading on Windows platforms should just work.
##' If you compile yourself, the new RTools toolchain is required.
##' See \url{https://github.com/imbs-hl/ranger} for the development version.
##'
##' @title Ranger
##' @param formula Object of class \code{formula} or \code{character} describing the model to fit. Interaction terms supported only for numerical variables.
Expand Down Expand Up @@ -133,7 +133,7 @@
##' @param quantreg Prepare quantile prediction as in quantile regression forests (Meinshausen 2006). Regression only. Set \code{keep.inbag = TRUE} to prepare out-of-bag quantile prediction.
##' @param time.interest Time points of interest (survival only). Can be \code{NULL} (default, use all observed time points), a vector of time points or a single number to use as many time points (grid over observed time points).
##' @param oob.error Compute OOB prediction error. Set to \code{FALSE} to save computation time, e.g. for large survival forests.
##' @param num.threads Number of threads. Default is number of CPUs available.
##' @param num.threads Number of threads. Default is 2 if not set by options/environment variables (see below).
##' @param save.memory Use memory saving (but slower) splitting mode. No effect for survival and GWAS data. Warning: This option slows down the tree growing, use only if you encounter memory problems.
##' @param verbose Show computation status and estimated runtime.
##' @param node.stats Save node statistics. Set to \code{TRUE} to save prediction, number of observations and split statistics for each node.
Expand Down
5 changes: 4 additions & 1 deletion man/predict.ranger.Rd

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

5 changes: 4 additions & 1 deletion man/predict.ranger.forest.Rd

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

8 changes: 4 additions & 4 deletions man/ranger.Rd

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

0 comments on commit 553aa9a

Please sign in to comment.