diff --git a/DESCRIPTION b/DESCRIPTION index 2ceaf979220381daf728acf39815ad15b655dce9..5b2267afb22f1b68a94998d8b6e2a1a44de26345 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: RFSurrogates Title: Surrogate Minimal Depth Variable Importance -Version: 0.3.3.9008 +Version: 0.3.4 Authors@R: c( person("Stephan", "Seifert", , "stephan.seifert@uni-hamburg.de", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-2567-5728")), @@ -36,5 +36,4 @@ LinkingTo: Config/testthat/edition: 3 Encoding: UTF-8 LazyData: true -Roxygen: list(markdown = TRUE) RoxygenNote: 7.2.3 diff --git a/R/addLayer.R b/R/addLayer.R index 03b7065b71f741ce06be09685a2416d0f3e7176b..78c91c42d4fa426ec2b33c6f7df0bd781549c754 100644 --- a/R/addLayer.R +++ b/R/addLayer.R @@ -18,6 +18,7 @@ #' * `layer`: Tree layer depth information, starting at 0 (root node) and incremented for each layer. #' #' @export +#' @md addLayer <- function(trees, num.threads = 1) { if (!inherits(trees, "RangerTrees")) { stop("`trees` must be a `getTreeranger` `RangerTrees` object.") @@ -42,6 +43,7 @@ addLayer <- function(trees, num.threads = 1) { #' @seealso [addLayer()] #' #' @keywords internal +#' @md add_layer_to_tree <- function(tree) { layer <- rep(NA, nrow(tree)) layer[1] <- 0 diff --git a/R/addSurrogates.R b/R/addSurrogates.R index 4c802da4596afd39bd7b4cf15e17839e0f6d9b67..93e31968db7fa2169987d51acdf227e6d13e247b 100644 --- a/R/addSurrogates.R +++ b/R/addSurrogates.R @@ -106,6 +106,7 @@ getSurrgate2 <- function( #' This is an internal function #' #' @keywords internal +#' @md getSurrogate <- function(surr.par, k = 1, maxsurr) { # weights and trees are extracted tree <- surr.par$trees[[k]] @@ -129,6 +130,7 @@ getSurrogate <- function(surr.par, k = 1, maxsurr) { #' @useDynLib RFSurrogates, .registration = TRUE #' #' @keywords internal +#' @md SurrTree <- function(j, wt, Xdata, controls, column.names, tree, maxsurr, ncat) { node <- tree[j, ] # for non-terminal nodes get surrogates @@ -182,6 +184,7 @@ SurrTree <- function(j, wt, Xdata, controls, column.names, tree, maxsurr, ncat) #' This is an internal function #' #' @keywords internal +#' @md name.surr <- function(i, surrogate.names) { surrogate.names <- c(surrogate.names, paste0("surrogate_", i)) return(surrogate.names) @@ -192,6 +195,7 @@ name.surr <- function(i, surrogate.names) { #' This is an internal function #' #' @keywords internal +#' @md name.adj <- function(i, adj.names) { adj.names <- c(adj.names, paste0("adj_", i)) return(adj.names) diff --git a/R/getTreeranger.R b/R/getTreeranger.R index 5dc21ddcb88c8ad5e4cf7141bcd3576a54525a8c..5f5dffd92287d830e5bde731353de1939a252a3f 100644 --- a/R/getTreeranger.R +++ b/R/getTreeranger.R @@ -19,6 +19,7 @@ #' * `layer`: If `add_layer` is `TRUE`, see [addLayer()] #' #' @export +#' @md getTreeranger <- function(RF, num.trees = RF$num.trees, add_layer = FALSE, num.threads = 1) { trees <- parallel::mclapply(1:num.trees, getsingletree, mc.cores = num.threads, @@ -53,6 +54,7 @@ getTreeranger <- function(RF, num.trees = RF$num.trees, add_layer = FALSE, num.t #' * `status`: `0` for terminal (`splitpoint` is `NA`) and `1` for non-terminal. #' #' @keywords internal +#' @md getsingletree <- function(RF, k = 1, add_layer = FALSE) { # here we use the treeInfo function of the ranger package to create extract the trees, in an earlier version this was done with a self implemented function tree.ranger <- ranger::treeInfo(RF, tree = k)