wrapper.rf: Wrapper function to call random forests function.

View source: R/variable_selection.R

wrapper.rfR Documentation

Wrapper function to call random forests function.

Description

Provides an interface to different parallel implementations of the random forest algorithm. Currently, only the ranger package is supported.

Usage

wrapper.rf(
  x,
  y,
  ntree = 500,
  mtry.prop = 0.2,
  nodesize.prop = 0.1,
  no.threads = 1,
  method = "ranger",
  type = "regression",
  importance = "impurity_corrected",
  case.weights = NULL,
  ...
)

Arguments

x

matrix or data.frame of predictor variables with variables in columns and samples in rows (Note: missing values are not allowed).

y

vector with values of phenotype variable (Note: will be converted to factor if classification mode is used).

ntree

number of trees.

mtry.prop

proportion of variables that should be used at each split.

nodesize.prop

proportion of minimal number of samples in terminal nodes.

no.threads

number of threads used for parallel execution.

method

implementation to be used ("ranger").

type

mode of prediction ("regression", "classification" or "probability").

importance

Variable importance mode ('none', 'impurity', 'impurity_corrected' or 'permutation'). Default is 'impurity_corrected'.

case.weights

Weights for sampling of training observations. Observations with larger weights will be selected with higher probability in the bootstrap (or subsampled) samples for the trees.

...

further arguments needed for holdout.rf function only.

Value

An object of class ranger.

Examples

# simulate toy data set
data = simulation.data.cor(no.samples = 100, group.size = rep(10, 6), no.var.total = 200)

# regression
wrapper.rf(x = data[, -1], y = data[, 1],
           type = "regression", method = "ranger")

silkeszy/Pomona documentation built on March 31, 2022, 11:13 p.m.