Fits an SDM workflow to data using resampling and prepares it for stacking.
Source:R/h3sdm_fit_model.R
h3sdm_fit_model.RdFits a Species Distribution Model (SDM) workflow to resampling data (cross-validation). This function is the main training step and optionally configures the results to be used with the 'stacks' package.
Usage
h3sdm_fit_model(
workflow,
data_split,
presence_data = NULL,
truth_col = "presence",
pred_col = ".pred_1",
for_stacking = FALSE,
...
)Arguments
- workflow
A 'workflow' object from tidymodels (e.g., GAM or Random Forest).
- data_split
An 'rsplit' or 'rset' object (e.g., result of vfold_cv or spatial_block_cv).
- presence_data
(Optional) Original presence data (used for extended metrics).
- truth_col
Column name of the response variable (defaults to "presence").
- pred_col
Column name for the prediction of the class of interest (defaults to ".pred_1").
- for_stacking
Logical. If
TRUE, usescontrol_stack_resamples()to save all workflow information required for the 'stacks' package. IfFALSE, uses the standard control withsave_pred = TRUE.- ...
Arguments passed on to other functions (e.g., to
tune::fit_resamplesif needed).