leaf: Learning Equations for Automated Function Discovery

A unified framework for symbolic regression (SR) and multi-view symbolic regression (MvSR) designed for complex, nonlinear systems, with particular applicability to ecological datasets. The package implements a four-stage workflow: data subset generation, functional form discovery, numerical parameter optimization, and multi-objective evaluation. It provides a high-level formula-style interface that abstracts and extends multiple discovery engines: genetic programming (via PySR), Reinforcement Learning with Monte Carlo Tree Search (via RSRM), and exhaustive generalized linear model search. 'leaf' extends these methods by enabling multi-view discovery, where functional structures are shared across groups while parameters are fitted locally, and by supporting the enforcement of domain-specific constraints, such as sign consistency across groups. The framework automatically handles data normalization, link functions, and back-transformation, ensuring that discovered symbolic equations remain interpretable and valid on the original data scale. Implements methods following ongoing work by the authors (2026, in preparation).

Version: 0.1.0
Imports: R6, utils, reticulate (≥ 1.30), ggplot2, dplyr, rlang, rappdirs, rstudioapi
Suggests: rmarkdown, knitr, testthat (≥ 3.0.0)
Published: 2026-04-21
DOI: 10.32614/CRAN.package.leaf (may not be active yet)
Author: Francisco Martins ORCID iD [cre, aut, cph], Pedro Cardoso ORCID iD [aut], Manuel Lopes ORCID iD [aut], Vasco Branco ORCID iD [aut], INESC-ID [fnd] (Financed by FCT - PTDC/CCI-COM/5060/2021), intell-sci-comput [cph] (Copyright holder of RSRM (<https://github.com/intell-sci-comput/RSRM>))
Maintainer: Francisco Martins <francisco.martins at tecnico.ulisboa.pt>
License: MIT + file LICENSE
Copyright: see inst/COPYRIGHTS
leaf copyright details
URL: https://github.com/NabiaAI/Leaf
NeedsCompilation: no
SystemRequirements: Conda, Python (>= 3.10)
Materials: README, NEWS
CRAN checks: leaf results

Documentation:

Reference manual: leaf.html , leaf.pdf
Vignettes: Multi-View Symbolic Regression with leaf (source)
Binary classification with leaf (source)
Cross-Validation for Symbolic Regression (source)
Getting Started with leaf (source)
Initialization (source, R code)
Manual Symbolic Regression: Testing Hypotheses (source)
Minimal Example: Quick Start (source)
Introduction to 2D Pareto Fronts (source, R code)
Train-Test Splitting for Symbolic Regression (source)

Downloads:

Package source: leaf_0.1.0.tar.gz
Windows binaries: r-devel: not available, r-release: leaf_0.1.0.zip, r-oldrel: leaf_0.1.0.zip
macOS binaries: r-release (arm64): leaf_0.1.0.tgz, r-oldrel (arm64): not available, r-release (x86_64): leaf_0.1.0.tgz, r-oldrel (x86_64): leaf_0.1.0.tgz

Linking:

Please use the canonical form https://CRAN.R-project.org/package=leaf to link to this page.