Skip to contents

This function returns a parsnip::model_spec for a Random Forest to be used as a classifier of presences and absences in Species Distribution Models. It uses the library ranger to fit boosted trees; to use another library, simply build the parsnip::model_spec directly.

Usage

sdm_spec_rand_forest(..., tune = c("sdm", "all", "custom", "none"))

sdm_spec_rf(..., tune = c("sdm", "all", "custom", "none"))

Arguments

...

parameters to be passed to parsnip::rand_forest() to customise the model. See the help of that function for details.

tune

character defining the tuning strategy. Valid strategies are:

  • "sdm" chooses hyperparameters that are most important to tune for an sdm (for rf, 'mtry')

  • "all" tunes all hyperparameters (for rf, 'mtry', 'trees' and 'min')

  • "custom" passes the options from '...'

  • "none" does not tune any hyperparameter

Value

a parsnip::model_spec of the model.

Details

sdm_spec_rf() is simply a short form for sm_spec_rand_forest().

Examples

test_rf_spec <- sdm_spec_rf(tune = "sdm")
test_rf_spec
#> Random Forest Model Specification (classification)
#> 
#> Main Arguments:
#>   mtry = tune()
#> 
#> Computational engine: ranger 
#> 
# combining tuning with specific values for other hyperparameters
sdm_spec_rf(tune = "sdm", trees = 100)
#> Random Forest Model Specification (classification)
#> 
#> Main Arguments:
#>   mtry = tune()
#>   trees = 100
#> 
#> Computational engine: ranger 
#>