
This repository contains the complete, reproducible end-to-end R pipeline for the research article: "Benchmarking AutoML against ensemble SDMs by using high-resolution elephant telemetry across a fence removal experiment".
The codebase provides a comprehensive framework to model species habitat suitability by directly contrasting the traditional Ensemble Species Distribution Modeling (SSDM package) approach against modern Automated Machine Learning (H2O AutoML). Using high-resolution GPS tracking data from African elephants before and after a major fence-removal event, this pipeline isolates the ecological and methodological divergences in how these two frameworks predict habitat suitability and spatial boundaries.
The project is executed via sequentially numbered scripts managed by a master execution wrapper (master_results_run.R), ensuring exact reproducibility. The workflow is divided into two major phases:
Phase 1: Spatial Data Processing & Model Training
01_ to 02_spatial_thinning.R: Ingests raw GPS telemetry data and applies DBSCAN algorithms to spatially thin occurrences, preventing spatial autocorrelation and sampling bias.03_h2o_train.R: Initializes an H2O cluster to train geographically cross-validated Stacked Ensemble machine learning models (AutoML) for each elephant cohort (Pre and Post-fence removal).04_ssdm_train.R: Trains comparative traditional Ensemble SDMs utilizing independent algorithm subsets (GLM, GBM, MARS, ANN, CTA) with randomized holdout replications.Phase 2: Movement Ecology & Methodological Evaluation
05a_h2o_vs_ssdm_panel.R & 05b_temporal_comparison.R: Generates spatial Jaccard indices and comparative mapping panels to quantify geographic boundary agreement between H2O and SSDM predictions.06_h20_vs_ssdm_agr_variable_imp.R: Aggregates variable importance scores across all methods and elephants to evaluate if AutoML identifies different primary ecological drivers compared to traditional SDMs.07b_ & 07c_cv_validation_plots.R: Extracts raw spatial block cross-validation metrics (H2O) and holdout replication metrics (SSDM) directly from saved model binaries, computing variance to validate structural model robustness.08_visualize_future_panels.R: Projects trained habitat models into various future climate scenarios to forecast spatial resilience.This repository uses renv to guarantee package version stability. To reproduce this analysis, ensure you open the project in R/RStudio so the .Rprofile activates, then run renv::restore() to automatically synchronize the required library states (such as h2o and SSDM) before running the master pipeline scripts.