rf: Runs random forest with grid-search for hyper parameters.

Description Usage Arguments Examples

View source: R/rf.R

Description

Runs random forest with grid-search for hyper parameters.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
rf(
  formula,
  train_df,
  probability,
  predict_df = NULL,
  mtry = NULL,
  node_size = NULL,
  num_trees = NULL,
  nfolds = NULL,
  error_type = "OOB",
  verbose = FALSE
)

Arguments

formula

Formula for model specification.

train_df

An input dataframe with y and X.

probability

Logical. Whether predicted values are probabilities or 0, 1 values.

predict_df

(Optional) A dataframe matching train_df. This is to generate predictions using the trained & tested model.

mtry

(Optional) Numeric vector including all values to try. Defines number of variables available for splitting at each tree node.

node_size

(Optional) Numeric vector including all values to try. Defines minimum number of observations in a terminal node.

num_trees

(Optional) Numeric vector including all values to try. Defines number of trees to grow.

nfolds

(Optional) Numeric value. Use to specify number of CV folds.

error_type

(Optional) String of either "CV" or "OOB" for error type to use for choosing optimal hyper parameters.

verbose

(Optional) Logical. Whether to print progress or not.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
idx <- train_test_validate(iris$Sepal.Length, train.p = .6, test.p = .2)

initialize_parallel()

rf_model <- rf(train_df = iris[idx$train, ],
               formula = Sepal.Length ~ .,
               probability = FALSE,
               predict_df = iris[idx$validate, ])

## End(Not run)

dmolitor/umbrella documentation built on Nov. 10, 2020, 1:25 a.m.