Predicting predator-prey interactions in terrestrial endotherms using random forest

Species interactions play a fundamental role in ecosystems. They affect where species can live, how their population sizes fluctuate through time, and how environmental perturbations cascade through communities. But few ecological communities have complete data describing such interactions, which is an obstacle to understanding how ecosystems function and respond to environmental perturbations. Because it is often impractical to collect empirical data for all potential interactions in a community, various methods have been developed to infer interactions. Random forest machine learning is emerging as one of the most accurate and frequently used methods for making interaction predictions, but its performance in inferring predator-prey interactions in terrestrial vertebrates remains untested. The sensitivity of random forest performance to variation in quality of training data is also unclear. We examined predator-prey interactions within and between two diverse, primarily terrestrial vertebrate classes: birds and mammals. Combining data from a global interaction dataset and a specific ecological community (Simpson Desert, Australia), we tested how well random forests predict predator-prey interactions for mammals and birds using species’ ecomorphological and phylogenetic traits. We also tested how variation in training data quality affected model performance by: removing records and switching interaction records to non-interactions (false non-interactions) in the entire training dataset, or restricting these changes to records involving focal prey, focal predators, or non-focal species (focal = species for which predictions are being made). We found that random forests could predict predator-prey interactions for birds and mammals using either ecomorphological or phylogenetic traits, and that these predictions were accurate even when there were no records in the training data for the focal predator or focal prey species. In contrast, false non-interactions for focal predators in the training data strongly degraded model performance. Our results demonstrate that random forests can be used to identify predator-prey interactions for bird and mammal species that have few or no trophic interaction records. Furthermore, our study provides a roadmap for predicting interactions using random forests which might help ecologists: (i) address knowledge gaps and explore network-related questions in data-poor situations and (ii) predict interactions for species invading new ecosystems. Data availability Data and script available from GitHub (DOI 10.5281/zenodo.7037189).