Skip to content

Commit

Permalink
getting docs updated
Browse files Browse the repository at this point in the history
  • Loading branch information
bcjaeger committed Oct 3, 2023
1 parent 0696ee1 commit f8c1f53
Show file tree
Hide file tree
Showing 13 changed files with 177 additions and 122 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
^Rmd/
lastMiKTeXException
^\.zenodo\.json$
^scratch\.R$
15 changes: 11 additions & 4 deletions R/orsf.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,23 @@
#' of randomly selected predictors, up to `n_retry` times. Default is
#' `n_retry = 3`. Set `n_retry = 0` to prevent any retries.
#'
#' @param n_thread `r roxy_n_thread_header()`
#' @param n_thread `r roxy_n_thread_header("growing trees, computing predictions, and computing importance.")`
#'
#' @param mtry (_integer_) Number of predictors randomly included as candidates
#' for splitting a node. The default is the smallest integer greater than
#' the square root of the number of total predictors, i.e.,
#' `mtry = ceiling(sqrt(number of predictors))`
#'
#' @param sample_with_replacement
#' @param sample_with_replacement (_logical_) If `TRUE` (the default),
#' observations are sampled with replacement when an in-bag sample
#' is created for a decision tree. If `FALSE`, observations are
#' sampled without replacement and each tree will have an in-bag sample
#' containing `sample_fraction`% of the original sample.
#'
#' @param sample_fraction
#' @param sample_fraction (_double_) the proportion of observations that
#' each trees' in-bag sample will contain, relative to the number of
#' rows in `data`. Only used if `sample_with_replacement` is `FALSE`.
#' Default value is 0.632.
#'
#' @param leaf_min_events (_integer_) minimum number of events in a
#' leaf node. Default is `leaf_min_events = 1`
Expand Down Expand Up @@ -186,7 +193,7 @@
#' to the output will be the imputed version of `data`.
#'
#' @param verbose_progress (_logical_) if `TRUE`, progress messages are
#' printed in the console.
#' printed in the console. If `FALSE` (the default), nothing is printed.
#'
#' @param ... `r roxy_dots()`
#'
Expand Down
5 changes: 5 additions & 0 deletions R/orsf_pd.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
#' percentile in the object's training data. If `FALSE`, these checks are
#' skipped.
#'
#' @param n_thread `r roxy_n_thread_header("computing predictions")`
#'
#' @param ... `r roxy_dots()`
#'
#' @return a [data.table][data.table::data.table-package] containing
Expand Down Expand Up @@ -309,6 +311,9 @@ orsf_pred_dependence <- function(object,

pred_horizon <- infer_pred_horizon(object, pred_horizon)

# make a visible binding for CRAN
id_variable = NULL

if(is.null(prob_values)) prob_values <- c(0.025, 0.50, 0.975)
if(is.null(prob_labels)) prob_labels <- c('lwr', 'medn', 'upr')

Expand Down
30 changes: 21 additions & 9 deletions R/orsf_predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@
#' observed time in `object`'s training data. If `FALSE`, these checks
#' are skipped.
#'
#' @param n_thread `r roxy_n_thread_header("computing predictions")`
#'
#' @param pred_aggregate (_logical_) If `TRUE` (the default), predictions
#' will be aggregated over all trees by taking the mean. If `FALSE`, the
#' returned output will contain one row per observation and one column
#' for each tree. If the length of `pred_horizon` is two or more and
#' `pred_aggregate` is `FALSE`, then the result will be a list of such
#' matrices, with the i'th item in the list corresponding to the i'th
#' value of `pred_horizon`.
#'
#' @inheritParams orsf
#'
#' @param ... `r roxy_dots()`
#'
#' @return a `matrix` of predictions. Column `j` of the matrix corresponds
Expand Down Expand Up @@ -119,15 +131,15 @@ predict.orsf_fit <- function(object,
results <- lapply(
X = pred_horizon,
FUN = function(t){
predict(object = object,
new_data = new_data,
pred_horizon = t,
pred_type = pred_type,
na_action = na_action,
boundary_checks = boundary_checks,
n_thread = n_thread,
verbose_progress = verbose_progress,
pred_aggregate = pred_aggregate)
predict.orsf_fit(object = object,
new_data = new_data,
pred_horizon = t,
pred_type = pred_type,
na_action = na_action,
boundary_checks = boundary_checks,
n_thread = n_thread,
verbose_progress = verbose_progress,
pred_aggregate = pred_aggregate)

Check warning on line 142 in R/orsf_predict.R

View check run for this annotation

Codecov / codecov/patch

R/orsf_predict.R#L131-L142

Added lines #L131 - L142 were not covered by tests
}
)

Expand Down
5 changes: 3 additions & 2 deletions R/roxy.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ roxy_data_allowed <- function(){

# multi-threading ---------------------------------------------------------

roxy_n_thread_header <- function(){
"(_integer_) number of threads to use. Default is one thread."
roxy_n_thread_header <- function(action){
paste("(_integer_) number of threads to use while ",
action, ". Default is one thread.", sep = "")
}

roxy_n_thread_details <- function(){
Expand Down
15 changes: 11 additions & 4 deletions man/orsf.Rd

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

10 changes: 5 additions & 5 deletions man/orsf_control_custom.Rd

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

22 changes: 12 additions & 10 deletions man/orsf_ice_oob.Rd

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

36 changes: 19 additions & 17 deletions man/orsf_pd_oob.Rd

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

Loading

0 comments on commit f8c1f53

Please sign in to comment.