# Load example raster data
raster_paths <- list.files(system.file("extdata", package = "ldmppr"),
pattern = "\\.tif$", full.names = TRUE
)
raster_paths <- raster_paths[!grepl("_med\\.tif$", raster_paths)]
rasters <- lapply(raster_paths, terra::rast)
# Scale the rasters
scaled_raster_list <- scale_rasters(rasters)
# Load example locations
locations <- small_example_data %>%
dplyr::mutate(time = power_law_mapping(size, .5))
# Train the model
mark_model <- train_mark_model(
data = locations,
raster_list = scaled_raster_list,
scaled_rasters = TRUE,
model_type = "xgboost",
xy_bounds = c(0, 25, 0, 25),
parallel = FALSE,
include_comp_inds = FALSE,
competition_radius = 10,
correction = "none",
selection_metric = "rmse",
cv_folds = 3,
tuning_grid_size = 2,
verbose = TRUE
)
print(mark_model)
Run the code above in your browser using DataLab