rforest: Random Forest using Ranger

View source: R/rforest.R

rforestR Documentation

Random Forest using Ranger

Description

Random Forest using Ranger

Usage

rforest(
  dataset,
  rvar,
  evar,
  type = "classification",
  lev = "",
  mtry = NULL,
  num.trees = 100,
  min.node.size = 1,
  sample.fraction = 1,
  replace = NULL,
  num.threads = 12,
  wts = "None",
  seed = NA,
  data_filter = "",
  arr = "",
  rows = NULL,
  envir = parent.frame(),
  ...
)

Arguments

dataset

Dataset

rvar

The response variable in the model

evar

Explanatory variables in the model

type

Model type (i.e., "classification" or "regression")

lev

Level to use as the first column in prediction output

mtry

Number of variables to possibly split at in each node. Default is the (rounded down) square root of the number variables

num.trees

Number of trees to create

min.node.size

Minimal node size

sample.fraction

Fraction of observations to sample. Default is 1 for sampling with replacement and 0.632 for sampling without replacement

replace

Sample with (TRUE) or without (FALSE) replacement. If replace is NULL it will be reset to TRUE if the sample.fraction is equal to 1 and will be set to FALSE otherwise

num.threads

Number of parallel threads to use. Defaults to 12 if available

wts

Case weights to use in estimation

seed

Random seed to use as the starting point

data_filter

Expression entered in, e.g., Data > View to filter the dataset in Radiant. The expression should be a string (e.g., "price > 10000")

arr

Expression to arrange (sort) the data on (e.g., "color, desc(price)")

rows

Rows to select from the specified dataset

envir

Environment to extract data from

...

Further arguments to pass to ranger

Details

See https://radiant-rstats.github.io/docs/model/rforest.html for an example in Radiant

Value

A list with all variables defined in rforest as an object of class rforest

See Also

summary.rforest to summarize results

plot.rforest to plot results

predict.rforest for prediction

Examples

rforest(titanic, "survived", c("pclass", "sex"), lev = "Yes") %>% summary()
rforest(titanic, "survived", c("pclass", "sex")) %>% str()
rforest(titanic, "survived", c("pclass", "sex"), max.depth = 1)
rforest(diamonds, "price", c("carat", "clarity"), type = "regression") %>% summary()


radiant.model documentation built on Oct. 16, 2023, 9:06 a.m.