## Introduction

Artificial Neural Networks (ANN) refers to a large group of computational models inspired by biological neural networks, particularly the brain, that uses extensive interconnected networks of neurons to process information. Similarly, Artificial Neural Networks can be used as a modelling technique to predict biodiversity distribution, using the relationship and connections of a set of layers (Figure 1). Typically, it comprises three main types of layers:

- an input layer of independent predictor variables that are fed into the model,
- several hidden layers, consisting of a linear combination of the input layer; and
- output layers, comprising response variables, which represent the results of the model.

We focus here on single hidden layer feed-forward Artificial Neural Networks that are trained by back-propagation, which are the most used ANNs in ecology.

The input layer consists of the environmental data put in the model, with each input node representing one environmental variable. The variables can either be continuous or categorical. The information from each node in the input layer is fed into the hidden layer (Figure 2). The connections between the nodes in the input and hidden layer can all be given a specific weight based on their importance. These weights are usually randomly assigned at the start of the model, but the model can learn and optimize the weights in subsequent runs in the back-propagation process. The higher the weight of a connection, the more influence that input node has.

The nodes in the hidden layer comprise different combinations of environmental variables on a linear combination, where the input is multiplied by the weight of the connection and summed. This calculation is done for each node in the hidden layer. The weighted sums in each hidden layer node are passed into an ‘activation function’, which transforms the weighted input signal into an understandable output signal. There are different forms of activation functions, the most used is the logistic function, which produces a sigmoid curve with an outcome between 0 and 1. The result is then passed to the output layer (Figure 2). Like the input and hidden layers, the connections between the hidden layers and the output layer are weighted. Thus, the output results from the weighted sum of the hidden nodes. In a species distribution model, the output layer predicts whether a species will be present or absent in each location.

As part of the model training, the output is compared to the desired output (Figure 2). In a species distribution model, the desired output is the known occurrence locations and the environmental conditions of those locations. The difference between the predicted outcome of the model and the desired outcome is the model's error, which can improve the model in the back-propagation process. Here, the weight of each connection is multiplied by the difference between the model and the desired output (Figure 2). Based on these new weighted connections, the nodes in the hidden layer can adjust the weights of the connections to the input layer. After adjusting the weights, the mode recalculates the output in a feed-forward way, from the input layer through the hidden layer to the output. This process is repeated several times until the model reaches a pre-defined accuracy or a maximum set number of runs.

## Advantages

- High predictive power
- Able to handle large datasets
- Able to model non-linear associations between the response and the predictors

## Limitations

- Sensitive to missing data and outliers
- Less efficient in handling data of ‘mixed types’
- Time-consuming

## Assumptions

No formal distributional assumptions (non-parametric).

## Requires absence data

Yes.

**Configuration options **

Biosecurity Commons allows the user to set specific model arguments as specified below.

prevalence | Allows to give more or less weight to particular observations; default = NULL: each observation (presence or absence) has the same weight; if value < 0.5: absences are given more weight; if value > 0.5: presences are given more weight. (algorithm parameter) |

Number of cross-validations (nbcv) | Number of cross-validations (integer values) to find the best size and decay parameters. (default = 5) |

size | Number of units in the hidden layer (integeger). If NULL, size will be optimised by cross-validation based on model AUC. (default = NULL) |

decay | Numeric parameter for weight decay. If NULL, decay will be optimised by cross-validation based on model AUC. (default = NULL) |

Initial random weights (rang) | Numeric value, corresponding to the initial random weights. (default = 0.1) |

Maximum number of iterations (maxit) | Integer valuer, corresponding to the maximum number of iterations. (default = 200) |

random_seed | Seed used for generating random values. Using the same seed value, i.e. 123, ensures that running the same model, with the same data and settings generates the same result, despite stochastic processes such as machine learning or cross-validation. |

Number of repetitions (nb_run_eval) | Integer value, corresponding to the number of repetitions to be done for calibration/validation splitting. (default = 10) |

Data split percentage (data_split) | Numeric value between 0 and 100, corresponding to the percentage of data used to calibrate the models (calibration/validation splitting). (default = 100) |

Variable importance (var_import) | Integer value, corresponding to the number of permutations to be done for each variable to estimate variable importance. (default = 0) |

Scale models (rescale_all_models) | A logical value defining whether all models predictions should be scaled with a binomial GLM or not. (default = FALSE) |

Evaluate all models (do_full_models) | A logical value defining whether models calibrated and evaluated over the whole dataset should be computed or not. (default = TRUE) |

## ANN in R

library(biomod2)

Usage: biomod2::BIOMOD_ModelingOptions

BIOMOD_ModelingOptions(GLM = NULL,

GBM = NULL,

GAM = NULL,

CTA = NULL,

ANN = NULL,

SRE = NULL,

FDA = NULL,

MARS = NULL,

RF = NULL,

MAXENT.Phillips = NULL)

// Specify ANN parameters

## References

- Franklin, J. (2010). Mapping species distributions: spatial inference and prediction. Cambridge University Press.
- Lek, S., & Guégan, J. F. (1999). Artificial neural networks as a tool in ecological modelling, an introduction. Ecological modelling, 120(2): 65-73.
- Olden, J. D., & Jackson, D. A. (2002). Illuminating the “black box”: a randomization approach for understanding variable contributions in artificial neural networks. Ecological modelling, 154(1): 135-150.
- Olden, J. D., Lawler, J. J., & Poff, N. L. (2008). Machine learning methods without tears: a primer for ecologists. The Quarterly review of biology, 83(2): 171-193.
- Thuiller, W., Georges, D., Gueguen, M., Engler, R., & Breiner, F. (2021). biomod2: Ensemble Platform for Species Distribution Modeling. R package version 3.5.1.

## Additional Reading

- Deneu, B., Servajean, M., Bonnet, P., Botella, C., Munoz, F., & Joly, A. (2021). Convolutional neural networks improve species distribution modelling by capturing the spatial structure of the environment. PLoS computational biology, 17(4), e1008856.
- Guisan, A., & Thuiller, W. (2005). Predicting species distribution: offering more than simple habitat models. Ecology letters, 8(9), 993-1009.
- Harris, D. J. (2015). Generating realistic assemblages with a joint species distribution model. Methods in Ecology and Evolution, 6(4), 465–473. https://doi.org/10.1111/2041-210X.12332
- Manel, S., Dias, J. M., & Ormerod, S. J. (1999). Comparing discriminant analysis, neural networks and logistic regression for predicting species distributions: a case study with a Himalayan river bird. Ecological modelling, 120(2-3), 337-347.
- Thuiller, W. (2003). BIOMOD–optimizing predictions of species distributions and projecting potential future shifts under global change. Global change biology, 9(10), 1353-1362.
- Zhang, C., Chen, Y., Xu, B., Xue, Y., & Ren, Y. (2020). Improving prediction of rare species’ distribution from community data. Scientific reports, 10(1), 1-9.
- Zurell, D., Franklin, J., König, C., Bouchet, P. J., Dormann, C. F., Elith, J., ... & Merow, C. (2020). A standard protocol for reporting species distribution models. Ecography, 43(9), 1261-1277.