The number of predictors that will be randomly sampled at each split when creating tree models.

mtry(range = c(1L, unknown()), trans = NULL)

mtry_long(range = c(0L, unknown()), trans = log10_trans())

Arguments

range

A two-element vector holding the defaults for the smallest and largest possible values, respectively.

trans

A trans object from the scales package, such as scales::log10_trans() or scales::reciprocal_trans(). If not provided, the default is used which matches the units used in range. If no transformation, NULL.

Details

This parameter is used for regularized or penalized models such as parsnip::rand_forest() and others. mtry_long() has the values on the log10 scale and is helpful when the data contain a large number of predictors.

Since the scale of the parameter depends on the number of columns in the data set, the upper bound is set to unknown but can be filled in via the finalize() method.

Examples

mtry(c(1L, 10L)) # in original units
#> # Randomly Selected Predictors (quantitative) #> Range: [1, 10]
mtry_long(c(0, 5)) # in log10 units
#> # Randomly Selected Predictors (quantitative) #> Transformer: log-10 #> Range (transformed scale): [0, 5]