Skip to content

Commit

Permalink
refactor: add classification argument
Browse files Browse the repository at this point in the history
  • Loading branch information
sgibb committed Mar 24, 2022
1 parent 9bd6553 commit 4cde870
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions R/rusranger.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#' details.
#' @param probability `logical(1)`, grow probability trees, see [`ranger()`]
#' for details.
#' @param classification `logical(1)`, run classification even if `y` is
#' `numeric`, see [`ranger()`] for details.
#' @param min.node.size, same as in [`ranger()`]
#' @param replace, subsampling without (default, `replace = FALSE`) or with
#' resampling, see [`ranger()`] for details.
Expand All @@ -32,12 +34,13 @@
#'
#' @import ranger
#' @export
rusranger <- function(x, y, probability = TRUE,
rusranger <- function(x, y, probability = TRUE, classification = !probability,
min.node.size = if (probability) 10 else 1,
replace = FALSE, ...) {
ranger(
x = as.data.frame(x), y = as.factor(y),
x = as.data.frame(x), y = y,
probability = probability,
classification = classification,
min.node.size = min.node.size,
## RUS
### subsample (replace == FALSE) vs bootstrap (replace == TRUE)
Expand Down
4 changes: 4 additions & 0 deletions man/rusranger.Rd

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

0 comments on commit 4cde870

Please sign in to comment.