Conservation Area Prioritization Through Artificial INtelligence
Kalena Sapp and Georgia Goldsmith
2026-09-02
Contents
What is CAPTAIN? Background on machine learning and key features
Getting started
Package architecture
Input data
Features & toggles
Parameters
Example UGF Case Study
Resources
Introduction to Conservation Prioritization using CAPTAIN
Captain is a spatial prioritization tool for conservation and restoration planning using artificial intelligence.
HOW IT WORKS: It does not create one “optimal” static map the way a solver does.
It trains an AI neural network model to learn a policy - a decision rule book - for protecting cells in a simulated landscape as it evolves, in order to optimize conservation strategies in space and time.
This is done through reinforcement-learning (RL), a type of machine learning process where AI “agents” learn to make decisions by interacting with their environment.
CAPTAIN workflow for minimizing biodiversity loss
Introduction to Conservation Prioritization using CAPTAIN
CAPTAIN uses AI Reinforcement Learning(RL) to train a model for area prioritization that achieves a conservation goal (e.g., minimizing species loss) based on empirically informed ecological simulations:
1. Simulates a landscape through time (e.g., species populations grow, disperse, and are affected by disturbance and climate).
At each timestep, the neural network (“policy”) scores every grid cell for how good it would be to protect.
Cells are protected within a budget, the simulation steps forward, and a reward is computed (e.g., reduced extinction risk, cost efficiency).
Training repeatedly perturbs the policy’s weights, re-runs episodes, and nudges the weights toward higher reward. This is known as Evolution Strategies.
Creator Daniele Silvestro explaining the CAPTAIN framework
Key CAPTAIN v.3 features
CAPTAIN v.3 is in active development, but its core features are functional. Builds upon previous CAPTAIN v.2 published at (Silvestro et al. 2022).
⚙️ Engineered for Scale: Full GPU support and optimized performance for analysis at larger scales and finer resolutions.
Once uv is installed, clone the repository and sync the dependencies. uv sync will automatically create a virtual environment (.venv) and install the correct version of PyTorch.
# Clone and enter the repositorygit clone https://github.com/captain-project/captain3previewcd captain3preview# Sync dependencies and create virtual environmentuv sync
3. Verify the install
>>>import captain as cn>>> cn.__version__
Project structure
Directory of files stored inside the captain project folder. Users only need to edit example files (next slide)
Loads a trained policy (train_policy.py) and runs one episode, producing protection maps and extinction-risk plots.
#terminaluv run calibrate_rewards.py # once, to generate reward_calibration.jsonuv run train_policy.py # Model training using empirical data inputsuv run run_inference.py. # Policy inference plots using trained.py output
Other: Internal Captain model scripts
These are the internal Captain scripts that process the data and run the model based on the input settings from your train_policy and run_inference .py scripts.
Each entry in reward_obj_list is one objective; reward_weights sets how they’re combined. This is CAPTAIN’s multi-objective optimization feature
threat_weights penalizes by IUCN category: [LC=1, NT=0, VU=-8, EN=-16, CR=-32]
4. Training loop parameters
Parameter
Role
↑ effect
↓ effect
Default in scripts
N_EPOCHS
ES iterations
Better-trained, slower
Faster, less converged
20
N_PERTURBATIONS
Population size/epoch
Stabler estimate, more compute
Noisier, seed-variance
6
N_TIME_STEPS
Episode length
Longer-horizon dynamics
Cheaper, may truncate
50
TARGET_PROTECTED_CELLS_FRACTION
Protection target
Larger footprint
Smaller footprint
0.10
CELLS_PER_STEP
Cells/timestep
Faster rollout
Gradual rollout
1000
5. Species / ecological parameters
Parameter
Role
Default
DISPERSAL_RATE
Legacy scalar control
0.5 — obsolete if dispersal_ability is used
DISPERSAL_WINDOW
Dispersal neighborhood radius
3
MIN_HABITAT_SUITABILITY
Presence threshold
0.5 in your scripts
ExtinctionRisk(n_classes=5, alpha=0.5)
5 IUCN classes
alpha shapes thresholds
Example Analysis: UGF Case Study
This example tutorial walks through training and evaluating a biodiversity conservation policy with CAPTAIN using 18 species over a grid of 135,830 cells in the UGF boundary of West Africa.
UGF_calibrate_rewards.py
│ creates reward_calibration.json. Run once before training
▼
UGF_train_policy.py
│ trains policy → trained_weights.npy
▼
UGF_run_inference.py + (GENERATE MAPS)
│ runs policy once → <trained policy>_log.tsv + reward_over_training.png
▼
Output Protection Policy
Step 1 - Prepare your empirical data
Assemble the empirical data inputs from Section 1, matching the directory/file structure the loader functions expect (present/future SDM directories, present/future disturbance and cost GeoTIFFs, trait CSV, area mask). Update DATA_DIR and the filename constants at the top of each script to point at your data.
# CONFIG — DATA PATHS# =============================================================================DATA_DIR = Path("/Users/captain3preview/ugf3_data") # <-- change this
Ex: Species trait table column headers
species_traits.csv
Spatial data layers
Composite AOH for 18 bird species in the Upper Guinean Forest (Lumbierres et al., 2022) weighted by extinction risk.
Established protected areas in the UGF by category, derived from UNEP-WCMC and IUCN, 2026.
Present day disturbance levels (2022) in the Upper Guinean Forest, derived from Theobald et al., 2025.
Opportunity cost for protection in the Upper Guinean Forest, represented as cocoa crop suitability for rainfed and irrigated crop land, derived from Zabel et al., 2024.
Step 2 - Experiment Toggles
Edited scripts (Ugf_*) wrap the examples in explicit toggles, each labeled [TOGGLE: ...] in the code:
Toggle
Options
Effect
SENSITIVITY_MODE
"empirical" / "flat"
Trait-based vs. constant sensitivity
INCLUDE_COST
True / False
Adds cost to reward and features
INCLUDE_FUTURE
True / False
Turns on time-evolving layers
INCLUDE_EXISTING_PROTECTED_AREAS
True / False
Start from real PA raster
USE_REGIONAL_AGENTS
True / False
Individual agents per region vs. single global agent
Toggles must match exactly between training and inference. Mismatch will silently change feature_extractor.n_features and errors or misload weights.
Edit parameters where necessary based on analysis testing for policy goal (or leave at default)
# Ex from UGF_train_policy.py# =============================================================================# CONFIG — TRAINING / POLICY PARAMETERSN_EPOCHS =100# Number of training iterationsN_PERTURBATIONS =6# Number of parallel episode evaluations (sequential on GPU)
# Ex from UGF_train_policy.py# =============================================================================# CONFIG — SPECIES / DISPERSAL PARAMETERSDISPERSAL_RATE =0.5# can be an array (per-species values)DISPERSAL_WINDOW =3
Step 4 - Run Training
#terminal # run calibrate rewards.py (run once per reward configuration & reuse for subsequent runs)uv run UGF_calibrate_rewards.py # only run again if reward_obj_list changes.# then run train_policy.pyuv run UGF_train_policy.py # Model training using empirical data inputs
Step 5 - Run Inference / apply trained policy
Rebuild the same setup as training in run_inference.py (must match the architecture the weights were trained with).
Match the same SEED and CONFIG toggle values (e.g., NUMBER_TIME_STEPS, INCLUDE_FUTURE, USE_REGIONAL_AGENTS) from the training script.
#Ex from UGF_run_inference.py SEED =# <-- same as training!# =============================================================================# CONFIG — DATA PATHS# (must match the training run's config exactly)DATA_DIR = Path("/Users/kalena/captain3preview/ugf3_data") # <-- change thisOUTPUTS_DIR = Path("/Users/kalena/captain3preview/outputs")#...#-------- future scenario layers (optional) -----------------------------------## [TOGGLE: FUTURE] Must match whatever the training run used. If these stay# None, delta_sdm/delta stays None and the layer doesn't change over time (present-day-only scenario)FUTURE_SDMS_DIR =None# e.g. "future_sdms"FUTURE_DISTURBANCE_FILE =None# e.g."environmental_layers/future_disturbance.tif"FUTURE_COST_FILE =None# e.g. "environmental_layers/future_cost.tif"
CAPTAIN Project Conservation Area Prioritization Through Artificial INtelligence: github.com/captain-project/
Silvestro, et al. (2025). Using artificial intelligence to optimize ecological restoration for climate and biodiversity. bioRxiv. https://doi.org/10.1101/2025.01.31.635975