ranger_filter: Random forest ranger filter

View source: R/filters.R

ranger_filterR Documentation

Random forest ranger filter

Description

Fits a random forest model via the ranger package and ranks variables by variable importance.

Usage

ranger_filter(
  y,
  x,
  nfilter = NULL,
  type = c("index", "names", "full"),
  num.trees = 1000,
  mtry = ncol(x) * 0.2,
  ...
)

Arguments

y

Response vector

x

Matrix or dataframe of predictors

nfilter

Number of predictors to return. If NULL all predictors are returned.

type

Type of vector returned. Default "index" returns indices, "names" returns predictor names, "full" returns a named vector of variable importance.

num.trees

Number of trees to grow. See ranger::ranger.

mtry

Number of predictors randomly sampled as candidates at each split. See ranger::ranger.

...

Optional arguments passed to ranger::ranger.

Details

This filter uses the ranger() function from the ranger package. Variable importance is calculated using mean decrease in gini impurity.

Value

Integer vector of indices of filtered parameters (type = "index") or character vector of names (type = "names") of filtered parameters. If type is "full" a named vector of variable importance is returned.


nestedcv documentation built on Oct. 26, 2023, 5:08 p.m.