Combines a model specification and a prepared recipe into a single tidymodels
workflow.
This workflow is suitable for species distribution modeling using H3 hexagonal grids
and can be directly fitted or cross-validated.
Arguments
- model_spec
A
tidymodels
model specification (e.g.,logistic_reg()
,rand_forest()
, orboost_tree()
), describing the model type and engine to use for fitting.- sdm_recipe
A
tidymodels
recipe object, typically created withh3sdm_recipe()
, which preprocesses the data and defines predictor/response roles.
Value
A workflow
object ready to be used for model fitting with fit()
or cross-validation.
Details
The function creates a workflow
that combines preprocessing and modeling
steps. This encapsulation allows consistent model training and evaluation
with tidymodels
functions like fit()
or fit_resamples()
, and is
particularly useful when applying multiple models in parallel.
Examples
if (FALSE) { # \dontrun{
library(parsnip)
# Example: Create a tidymodels workflow for H3-based species distribution modeling
# Step 1: Define model specification
my_model_spec <- logistic_reg() %>%
set_mode("classification") %>%
set_engine("glm")
# Step 2: Create recipe
my_recipe <- h3sdm_recipe(combined_data)
# Step 3: Combine into workflow
sdm_wf <- h3sdm_workflow(model_spec = my_model_spec, sdm_recipe = my_recipe)
} # }