Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

mtry

Number of randomly sampled predictors


Description

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

Usage

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
mtry_long(c(0, 5)) # in log10 units

dials

Tools for Creating Tuning Parameter Values

v0.0.10
MIT + file LICENSE
Authors
Max Kuhn [aut], Hannah Frick [aut, cre], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.