Trains a single tidymodels workflow using a spatial split, computes performance metrics for each fold, and fits the final model to the full dataset. Optionally computes post-hoc metrics like TSS and the Boyce index.
Usage
h3sdm_fit_model(
sdm_workflow,
data_split,
presence_data = NULL,
truth_col = "presence",
pred_col = ".pred_1"
)
Arguments
- sdm_workflow
A
workflow
object fromh3sdm_workflow()
or manually created.- data_split
A resampling object (e.g., from
vfold_cv()
orh3sdm_spatial_cv()
) for cross-validation.- presence_data
Optional
sf
or tibble with presence locations to compute Boyce index.- truth_col
Character. Name of the column containing the true presence/absence values (default
"presence"
).- pred_col
Character. Name of the column containing predicted probabilities (default
".pred_1"
).