Skip to content

Fits a set of tidymodels workflows using resampling with fit_resamples() and control_stack_resamples() to generate objects suitable for stacking. For each workflow, both the resampled model (cv_model) and the original workflow are returned. This is intended as a helper function for creating ensembles of multiple models in the h3sdm workflow.

Usage

h3sdm_fit_models_stack(workflows, data_split, presence_data = NULL)

Arguments

wfs

A named list of tidymodels workflows. Each element should be a workflow object.

scv

A resampling object, e.g., generated by rsample::vfold_cv().

datos_presencia

A data frame containing the data to fit the workflows on.

Value

A list with one element models. Each element of models is itself a list with:

  • cv_model: the resampled model (tune_results object)

  • workflow: the original workflow object

Details

Fit multiple workflows with resampling for stacking

Examples

if (FALSE) { # \dontrun{
# Assuming you have workflows 'wfs' and a spatial CV object 'scv'
results <- h3sdm_fit_models_stack(wfs, scv, datos_presencia)
results$models$random_forest$cv_model
results$models$random_forest$workflow
} # }