Abstract
Networks are a powerful way to represent the complexity of large ecological systems. However, most ecological networks, such as food webs, contain only partial lists of species interactions. Computational methods for inferring missing links can facilitate field work and investigations of ecological processes. Here, we describe a stacked generalization approach to predict missing links in food webs that accounts for ecological assumptions including link direction. Tests of this method on synthetic food webs show that it can learn to optimally combine structural and trait-based predictions. On a global database of 290 food webs, the method often achieves near-perfect performance, performs better when it can exploit both species traits and network structure, and is principally driven by a subset of ecologically-interpretable predictors. Furthermore, we find that link predictability varies with ecosystem and network characteristics. These results show broad applicability of stacked generalization for predicting and understanding ecological interactions.
Similar content being viewed by others
A network simplification approach to ease topological studies about the food-web architecture
A species-level multi-trophic metaweb for Switzerland
Network rewiring conserves the topology of drought-impaired food webs
Data availability
The empirical food-web datasets used in this study are available in the GATEWAy database (GlobAl daTabasE of traits and food Web Architecture33,37, version 3, accessible at https://doi.org/10.25829/idiv.283-3-756). The data was pre-processed as described in Supplementary Note 2. The pre-processed data are available at https://doi.org/10.5281/zenodo.18026669. Supplementary Data 1 includes food web features across the datasets and summary statistics for food web features split by ecosystem type. Supplementary Data 2 includes details of Beta regression results.
Code availability
The code for this paper is available at https://doi.org/10.5281/zenodo.18026669 ref. 71. Data pre-processing and missing link prediction scripts were run with Python 3.6.3 on CentOS Linux 7 using High Performance Computing resources supported by BioFrontiers IT. Results visualization scripts were run on Windows 11 with Python 3.12.4. A configuration file is provided in the code repository for reproducing a Python environment with the necessary packages for running the scripts.
References
Clauset, A., Moore, C. & Newman, M. E. J. Hierarchical structure and the prediction of missing links in networks. Nature 453, 98–101 (2008).
Ghasemian, A., Hosseinmardi, H., Galstyan, A., Airoldi, E. M. & Clauset, A. Stacking models for nearly optimal link prediction in complex networks. Proc. Natl. Acad. Sci. USA 117, 23393–23400 (2020).
Guimerà, R. & Sales-Pardo, M. Missing and spurious interactions and the reconstruction of complex networks. Proc. Natl. Acad. Sci. USA 106, 22073–22078 (2009).
Zhou, T. Progresses and challenges in link prediction. iScience 24, 103217 (2021).
Wolpert, D. H. Stacked generalization. Neural Netw. 5, 241–259 (1992).
Dunne, J. A., Brose, U., Williams, R. J. & Martinez, N. D. Modeling food-web dynamics: complexity-stability implications. In Aquatic food webs: an ecosystem approach, 117–129 (Oxford, 2005).
McDonald-Madden, E. et al. Using food-web theory to conserve ecosystems. Nat. Commun. 7, 10245 (2016).
Kamenova, S. et al. Invasions Toolkit. In Advances in Ecological Research, vol. 56, 85–182 (Elsevier, 2017). https://linkinghub.elsevier.com/retrieve/pii/S0065250416300587.
Van De Walle, R. et al. Arthropod food webs predicted from body size ratios are improved by incorporating prey defensive properties. J. Anim. Ecol. 92, 913–924 (2023).
Jordano, P. Sampling networks of ecological interactions. Funct. Ecol. 30, 1883–1893 (2016).
Terry, J. C. D. & Lewis, O. T. Finding missing links in interaction networks. Ecology 101, e03047 (2020).
Novak, M. et al. Predicting community responses to perturbations in the face of imperfect knowledge and network complexity. Ecology 92, 836–846 (2011).
Eklöf, A. et al. The dimensionality of ecological networks. Ecol. Lett. 16, 577–583 (2013).
Morales-Castilla, I., Matias, M. G., Gravel, D. & Araújo, M. B. Inferring biotic interactions from proxies. Trends Ecol. Evol. 30, 347–356 (2015).
Desjardins-Proulx, P., Laigle, I., Poisot, T. & Gravel, D. Ecological interactions and the Netflix problem. PeerJ 5, e3644 (2017).
Laigle, I. et al. Species traits as drivers of food web structure. Oikos 127, 316–326 (2018).
Pomeranz, J. P. F., Thompson, R. M., Poisot, T. & Harding, J. S. Inferring predator-prey interactions in food webs. Methods Ecol. Evol. 10, 356–367 (2019).
Gravel, D., Poisot, T., Albouy, C., Velez, L. & Mouillot, D. Inferring food web structure from predator-prey body size relationships. Methods Ecol. Evol. 4, 1083–1090 (2013).
Nagelkerke, L. A. J. & Rossberg, A. G. Trophic niche-space imaging, using resource and consumer traits. Theor. Ecol. 7, 423–434 (2014).
Wootton, K. L. et al. Layer-specific imprints of traits within a plant-herbivore-predator network – complementary insights from complementary methods. Ecography 2024, e07028 (2024).
Digel, C., Riede, J. O. & Brose, U. Body sizes, cumulative and allometric degree distributions across natural food webs. Oikos 120, 503–509 (2011).
Allesina, S. & Pascual, M. Food web models: a plea for groups. Ecol. Lett. 12, 652–662 (2009).
Williams, R. J. & Martinez, N. D. Simple rules yield complex food webs. Nature 404, 180–183 (2000).
Dalla Riva, G. V. & Stouffer, D. B. Exploring the evolutionary signature of food webs’ backbones using functional traits. Oikos 125, 446–456 (2016).
Rohr, R. P., Naisbit, R. E., Mazza, C. & Bersier, L.-F. Matching-centrality decomposition and the forecasting of new links in networks. Proc. R. Soc. B Biol. Sci. 283, 20152702 (2016).
Rohr, R., Scherer, H., Kehrli, P., Mazza, C. & Bersier, L. Modeling food webs: exploring unexplained structure using latent traits. Am. Naturalist 176, 170–177 (2010).
Williams, R. J., Anandanadesan, A. & Purves, D. The probabilistic niche model reveals the niche structure and role of body size in a complex food web. PLoS ONE 5, e12092 (2010).
Pearse, I. S. & Altermatt, F. Predicting novel trophic interactions in a non-native world. Ecol. Lett. 16, 1088–1094 (2013).
Stock, M., Poisot, T., Waegeman, W. & De Baets, B. Linear filtering reveals false negatives in species interaction data. Sci. Rep. 7, 45908 (2017).
Papadogeorgou, G., Bello, C., Ovaskainen, O. & Dunson, D. B. Covariate-informed latent interaction models: addressing geographic & taxonomic bias in predicting bird-plant interactions. J. Am. Stat. Assoc. 118, 2250–2261 (2023).
Poisot, T. Guidelines for the prediction of species interactions through binary classification. Methods Ecol. Evol. 14, 1333–1345 (2023).
Guimerà, R. One model to rule them all in network science? Proc. Natl. Acad. Sci. USA 117, 25195–25197 (2020).
Brose, U. GlobAL daTabasE of traits and food Web Architecture (GATEWAy) version 1.0 (2018). https://idata.idiv.de/ddm/Data/ShowData/283?version=3.
Holland, P. W., Laskey, K. B. & Leinhardt, S. Stochastic blockmodels: first steps. Soc. Netw. 5, 109–137 (1983).
Penrose, M. Random geometric graphs (Oxford University Press, 2003). OCLC: 271204794.
Ling, C. X., Huang, J. & Zhang, H. AUC: A Better Measure than Accuracy in Comparing Learning Algorithms. In Xiang, Y. & Chaib-draa, B. (eds.) Advances in Artificial Intelligence, vol. 2671, 329–341 (Springer Berlin Heidelberg, Berlin, Heidelberg, 2003). http://link.springer.com/10.1007/3-540-44886-1_25. Series Title: Lecture Notes in Computer Science.
Brose, U. et al. Predator traits determine food-web architecture across ecosystems. Nat. Ecol. Evol. 3, 919–927 (2019).
Brimacombe, C., Bodner, K., Michalska-Smith, M., Poisot, T. & Fortin, M.-J. Shortcomings of reusing species interaction networks created by different sets of researchers. PLoS Biol. 21, e3002068 (2023).
Bohan, D. A., Caron-Lormier, G., Muggleton, S., Raybould, A. & Tamaddoni-Nezhad, A. Automated discovery of food webs from ecological data using logic-based machine learning. PLoS ONE 6, e29028 (2011).
Stouffer, D. B., Rezende, E. L. & Amaral, L. A. N. The role of body mass in diet contiguity and food-web structure: body mass and food-web structure. J. Anim. Ecol. 80, 632–639 (2011).
Huxham, M., Beaney, S. & Raffaelli, D. Do parasites reduce the chances of triangulation in a real food web? Oikos 76, 284 (1996).
Brose, U. et al. Consumer-resource body size relationships in natural food webs. Ecology 87, 2411–2417 (2006).
Pichler, M., Boreux, V., Klein, A., Schleuning, M. & Hartig, F. Machine learning algorithms to infer trait-matching and predict species interactions in ecological networks. Methods Ecol. Evol. 11, 281–293 (2020).
Caron, D. et al. Trait-matching models predict pairwise interactions across regions, not food web properties. Glob. Ecol. Biogeogr. 33, e13807 (2024).
Strydom, T. et al. A roadmap towards predicting species interaction networks (across space and time). Philos. Trans. R. Soc. B Biol. Sci. 376, 20210063 (2021).
Barner, A. K., Coblentz, K. E., Hacker, S. D. & Menge, B. A. Fundamental contradictions among observational and experimental estimates of non-trophic species interactions. Ecology 99, 557–566 (2018).
Blanchet, F. G., Cazelles, K. & Gravel, D. Co-occurrence is not evidence of ecological interactions. Ecol. Lett. 23, 1050–1063 (2020).
Li, J. et al. A size-constrained feeding-niche model distinguishes predation patterns between aquatic and terrestrial food webs. Ecol. Lett. 26, 76–86 (2023).
Cattin, M.-F., Bersier, L.-F., Banašek-Richter, C., Baltensperger, R. & Gabriel, J.-P. Phylogenetic constraints and adaptation explain food-web structure. Nature 427, 835–839 (2004).
Ives, A. & Godfray, H. Phylogenetic analysis of trophic associations. Am. Naturalist 168, E1–E14 (2006).
Petchey, O. L., Beckerman, A. P., Riede, J. O. & Warren, P. H. Size, foraging, and food web structure. Proc. Natl. Acad. Sci. USA 105, 4191–4196 (2008).
Grover, A. & Leskovec, J. node2vec: Scalable Feature Learning for Networks. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 855–864 (ACM, 2016). https://doi.org/10.1145/2939672.2939754.
Strydom, T. et al. Graph embedding and transfer learning can help predict potential species interaction networks despite data limitations. Methods Ecol. Evol. 14, 2917–2930 (2023).
Lafferty, K. D. et al. Parasites in food webs: the ultimate missing links. Ecol. Lett. 11, 533–546 (2008).
Michalska-Smith, M. J. & Allesina, S. Telling ecological networks apart by their structure: a computational challenge. PLOS Comput. Biol. 15, e1007076 (2019).
Bar-Hen, A., Barbillon, P. & Donnet, S. Block models for generalized multipartite networks: applications in ecology and ethnobiology. Stat. Model. 22, 273–296 (2022).
Jacobs, A. Z., Dunne, J. A., Moore, C. & Clauset, A. Untangling the roles of parasites in food webs with generative network models (2015). Preprint, arxiv:1505.04741.
Pringle, R. M. & Hutchinson, M. C. Resolving food-web structure. Annu. Rev. Ecol. Evol. Syst. 51, 55–80 (2020).
Tabouy, T., Barbillon, P. & Chiquet, J. Variational inference for stochastic block models from sampled data. J. Am. Stat. Assoc. 115, 455–466 (2020).
He, X. et al. Link prediction accuracy on real-world networks under non-uniform missing-edge patterns. PLoS ONE 19, e0306883 (2024).
Settles, B. From theories to queries: Active learning in practice. In Guyon, I., Cawley, G., Dror, G., Lemaire, V. & Statnikov, A. (eds.) Active Learning and Experimental Design workshop In conjunction with AISTATS 2010, vol. 16 of Proceedings of Machine Learning Research, 1–18 (PMLR, 2011). https://proceedings.mlr.press/v16/settles11a.html.
Biton, B., Puzis, R. & Pilosof, S. Inductive link prediction facilitates the discovery of missing links and enables cross-community inference in ecological networks. Nature Ecology & Evolution 1–10 (Springer, 2025).
Botella, C., Dray, S., Matias, C., Miele, V. & Thuiller, W. An appraisal of graph embeddings for comparing trophic network architectures. Methods Ecol. Evol. 13, 203–216 (2022).
He, X., Ghasemian, A., Lee, E., Clauset, A. & Mucha, P. J. Sequential stacking link prediction algorithms for temporal networks. Nat. Commun. 15, 1364 (2024).
Breiman, L. Random Forests. Mach. Learn. 45, 5–32 (2001).
Eklöf, A. & Ebenman, B. Species loss and secondary extinctions in simple and complex model communities. J. Anim. Ecol. 75, 239–246 (2006).
Liben-Nowell, D. & Kleinberg, J. The link-prediction problem for social networks. J. Am. Soc. Inf. Sci. Technol. 58, 1019–1031 (2007).
Cirtwill, A. R. & Wootton, K. L. Stable motifs delay species loss in simulated food webs. Oikos2022 (2022). https://onlinelibrary.wiley.com/doi/10.1111/oik.09436.
Newman, M. E. J. & Clauset, A. Structure and inference in annotated networks. Nat. Commun. 7, 11863 (2016).
Cribari-Neto, F. & Zeileis, A. Beta regression in r. J. Stat. Softw. 34, 1–24 (2010).
Van Kleunen, L., Dee, L. E., Wootton, K. L., Massol, F. & Clauset, A. Predicting missing links in food webs using stacked models and species traits (2025). https://doi.org/10.5281/zenodo.18026669.
Acknowledgements
The authors thank the Brose lab for help with the empirical data, A. Ghasemian for helpful conversations about stacking models for link prediction, and B. Singh, D.B. Larremore and E. Bradley for helpful discussions and feedback. This work was supported in part by the National Science Foundation Division of Ocean Sciences (NSF OCE 2049360), the Eppley Foundation for Research, and the Chateaubriand Fellowship of the Office for Science & Technology of the Embassy of France in the United States. The stacking model code used here is adapted for use in directed, attributed, hierarchical networks from Ghasemian et al. (2020). The authors acknowledge the BioFrontiers Computing Core at the University of Colorado Boulder for providing High Performance Computing resources supported by BioFrontiers IT.
Author information
Authors and Affiliations
Contributions
L.V., L.D., and A.C. conceptualized the study. L.D. and A.C. supervised the study. L.V. and A.C. designed the methodology and performed the mathematical analysis. L.V., L.D., and K.W. planned and validated the data pre-processing steps. L.V. wrote the code to pre-process the data, performed the computational analysis, and visualized results. L.D., K.W., F.M., and A.C. provided feedback to validate and improve the computational analysis and visualizations. L.V. and A.C. wrote an initial paper draft and all authors contributed to final paper writing, review, and editing.
Corresponding authors
Ethics declarations
Competing interests
The authors declare no competing interests.
Peer review
Peer review information
Communications Materials thanks Chencheng Cai, Virginia Dominguez-Garcia, and the other, anonymous, reviewer(s) for their contribution to the peer review of this work. A peer review file is available.
Additional information
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Supplementary information
Supplementary Information
Description of Additional Supplementary Information
Supplementary Dataset 1
Supplementary Dataset 2
Reporting Summary
Transparent Peer Review file
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have permission under this licence to share adapted material derived from this article or parts of it. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
Reprints and permissions
About this article
Cite this article
Van Kleunen, L.B., Dee, L.E., Wootton, K.L. et al. Predicting missing links in food webs using stacked models and species traits.
Nat Commun (2026). https://doi.org/10.1038/s41467-026-68769-7
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41467-026-68769-7
Source: Ecology - nature.com
