Skip to content

Code for the paper "Neural hierarchical models of ecological populations"

License

Notifications You must be signed in to change notification settings

mbjoseph/neuralecology

Repository files navigation

Neural hierarchical models of ecological populations

DOI

Paper: https://onlinelibrary.wiley.com/doi/full/10.1111/ele.13462
Preprint: https://www.biorxiv.org/content/10.1101/759944v3

Key idea

Parameterize a hierarchical model (an observation + process + parameter model) with a neural network, creating a neural hierarchical model.

Alt text

Here, (a) shows linear regression, mapping input x to an output y. In (b) a neural network inserts hidden layers between x and y. Analogously, an ecological model (c) maps an input x to parameters of a hierarchical model. A neural version of model (d) would similarly involve hidden layers between x and these parameters. Deep models (e) can also be constructed that use more complex neural architectures, especially when data are structured in time, space, and/or over networks.

A variety of neural network components can be readily used in neural hierarchical models. For example, you might parameterize a hidden Markov model of animal movement using a convolutional neural network that takes remotely sensed imagery as input (see Appendix S2 for details).

convHMM

Hardware requirements

  • 20+ GB of RAM
  • 4 or more CPU cores
  • GPU recommended

Setting up the environment

This project uses conda to install python dependencies.

conda env create -f environment.yml

Once installed, activate the environment via:

conda activate neural-ecology

To install R dependencies:

R -e "devtools::install_deps(dependencies = TRUE)"

Running the toy models

Binder

The notebooks/ subdirectory contains toy models in Jupyter notebooks:

Building the paper

The workflow for building the paper is handled with GNU Make. To build the paper (including running the models for the case study) takes ~ 5 hours with 6 CPU cores and a GPU.

make