The Insect-Based Biodiversity Intactness Index (i-BII) is a reproducible geospatial modeling framework designed to quantify and map patterns of insect biodiversity intactness across Africa. The workflow integrates species occurrence records, environmental predictor variables, spatially explicit machine learning models, spatial block cross-validation, and uncertainty assessment to generate continent-wide biodiversity intactness estimates.
The framework addresses major challenges in large-scale biodiversity modeling, including spatial sampling bias, spatial autocorrelation, uneven observation effort, and uncertainty in model predictions. The resulting products provide scientifically robust indicators that can support biodiversity monitoring, conservation planning, ecological assessment, and environmental policy development.
The i-BII framework estimates biodiversity intactness as the ratio between:
- Observed Biodiversity Suitability (D): Ensemble model predictions representing current insect biodiversity conditions.
- Potential Biodiversity Baseline (P): A reference surface representing potential biodiversity under minimally disturbed ecological conditions.
The Biodiversity Intactness Index is calculated as:
[ iBII = \frac{D}{P} ]
where:
- (iBII \in [0,1])
- Values approaching 1 indicate biodiversity conditions close to their potential state.
- Values approaching 0 indicate substantial biodiversity degradation relative to the potential baseline.
To improve interpretation and reliability, the workflow additionally quantifies spatial observational uncertainty and masks areas with insufficient observational support.
The workflow is organized into modular processing stages that can be executed independently or as a complete end-to-end pipeline.
Figure 1. End-to-end workflow for generating the Insect-Based Biodiversity Intactness Index (i-BII), from occurrence data preprocessing through ensemble modelling, uncertainty assessment, and final biodiversity intactness mapping.
File: src/00_preprocess_occurrences.py
Processes raw species occurrence datasets by:
- Applying spatial thinning to reduce clustering and sampling bias.
- Reprojecting records into an equal-area coordinate system (
ESRI:102022). - Merging occurrence datasets from multiple sources.
- Producing cleaned occurrence datasets suitable for model development.
- Species occurrence shapefiles
- Supplementary occurrence CSV datasets
- Spatially thinned occurrence dataset
File: src/01_data_prep.py
Extracts environmental predictor variables for presence and pseudo-absence observations.
- Raster extraction
- Covariate harmonization
- Missing value handling
- Feature matrix generation
- Training feature matrix
- Presence/pseudo-absence labels
File: src/02_block_cv.py
Implements geographically structured cross-validation to account for spatial autocorrelation and improve model transferability.
- Spatial block generation
- Fold assignment
- Spatially independent training/testing partitions
Conventional random cross-validation often overestimates predictive performance because neighboring observations are not independent. Spatial block validation provides more realistic estimates of predictive performance and model generalization.
- Spatial cross-validation folds
- Fold assignment layers
File: src/03_model_training.py
Trains and evaluates machine-learning biodiversity models.
- Model fitting
- Cross-validation
- Performance evaluation
- Ensemble construction
- Area Under the ROC Curve (AUC)
- Fold-specific validation statistics
- Ensemble performance summaries
- Trained models
- Ensemble weighting parameters
- Validation metrics
File: src/04_predict_ensemble.py
Generates continental-scale biodiversity suitability predictions.
- Raster-based prediction
- Ensemble averaging
- Continental suitability mapping
- Biodiversity suitability surface ((D))
File: src/05_compute_ibii_exports.py
Computes biodiversity intactness metrics and associated uncertainty products.
Aligns ensemble predictions with the potential biodiversity baseline ((P)) and calculates:
[ iBII = \frac{D}{P} ]
Generates a smoothed observational support surface based on the spatial distribution of occurrence records.
Uncertainty is quantified as the discrepancy between modeled biodiversity intactness and local observational support:
[ U = | iBII - S | ]
where:
- (U) = observational uncertainty
- (S) = observational support
Areas exhibiting high predicted biodiversity but limited sampling support receive higher uncertainty values.
Pixels exceeding the specified uncertainty threshold are masked to produce a conservative biodiversity intactness product.
- Intactness maps
- Observational support surfaces
- Uncertainty layers
- Reliability-filtered products
Figure 2. Continental-scale Insect-Based Biodiversity Intactness Index (i-BII) after incorporating observational uncertainty. Areas with limited observational support are associated with increased uncertainty and are appropriately reflected in the final biodiversity intactness estimates.
Figure 3. Independent validation of the i-BII framework using bird biodiversity observations. The relationship demonstrates the ecological consistency of insect-derived biodiversity intactness estimates with independently observed avian biodiversity patterns.
The Docker image contains all required geospatial dependencies, including GDAL, PROJ, GEOS, and raster processing libraries.
docker build -t ibii-python-pipeline .docker run --rm \
-v $(pwd)/data:/app/data \
ibii-python-pipeline --step allCreate and activate a virtual environment:
python -m venv venv
source venv/bin/activateInstall dependencies:
pip install -r requirements.txtIndividual workflow components can be executed independently.
python main.py --step preprocesspython main.py --step data_preppython main.py --step block_cvpython main.py --step trainpython main.py --step predictpython main.py --step computepython main.py --step allAll outputs are written to:
data/output/
| Output File | Description |
|---|---|
ensemble_suitability.tif |
Continental ensemble biodiversity suitability surface (D) |
potential_diversity.tif |
Potential biodiversity baseline (P) |
intactness_ratio.tif |
Biodiversity Intactness Index (D/P) bounded to [0,1] |
observational_support.tif |
Smoothed observational support surface derived from occurrence density |
iBII_observational_uncertainty.tif |
Spatial uncertainty layer quantifying disagreement between intactness and observational support |
iBII_uncertainty_classes.tif |
Reclassified uncertainty layer (Very Low–Very High) |
iBII_reliable.tif |
Reliability-filtered biodiversity intactness product with highly uncertain areas masked |
cross_validation_metrics.csv |
Spatial block validation performance metrics |
ensemble_model.pkl |
Trained ensemble biodiversity model |
The i-BII framework can support:
- Continental biodiversity monitoring
- Biodiversity hotspot identification
- Protected area assessment
- Ecological restoration prioritization
- National biodiversity reporting
- Conservation planning and decision support
- Tracking biodiversity responses to environmental change
This workflow was developed to support fully reproducible biodiversity modeling across Africa. All stages are containerized, version-controlled, and designed to operate consistently across computational environments, ensuring transparent and repeatable biodiversity assessments at continental scale.


