Symbolic regression
How symbolic regression searches the space of mathematical expressions to discover compact, interpretable equations that fit data, from genetic programming to sparse identification of dynamics.
What it is
Symbolic regression is a machine-learning technique that searches for a mathematical formula that describes data, rather than fitting the parameters of a model whose form is fixed in advance. Linear regression assumes y = a + bx; a neural network learns a function that is accurate but not readable. Symbolic regression instead explores combinations of variables, constants and operators (+, −, ×, ÷, powers, sin, exp, log) and returns equations such as y = 0.5 g t2, with the structure itself discovered from the data. The result is compact and interpretable, can be examined by scientists, and may extrapolate better than a black box. The field began with genetic programming (John Koza, 1992) and drew wide attention with the Eureqa program (Schmidt and Lipson, 2009), which rediscovered conservation laws from motion data. Modern tools include PySR, AI Feynman and sparse identification methods.
It answers questions such as: What equation relates these measured variables? Can a physical law or empirical correlation be extracted from experimental or simulation data? What is the governing differential equation of this dynamical system? Is there a simple formula that approximates this complex simulation? It gives candidates for scientific insight, not proof, so results must be checked for physical sense and tested on new data.
Fundamentals
Expression search
An expression is represented as a tree: leaves are variables and constants, internal nodes are operators. The space of possible trees is enormous and discrete, and finding the best expression is NP-hard, so heuristics are used. In genetic programming, a population of random expression trees evolves through selection of the fittest, crossover (swapping subtrees between two parents) and mutation (changing a node, constant or subtree), with fitness measured by error on the data. Numerical constants inside expressions are optimized with gradient-based or quasi-Newton methods (BFGS), which greatly improves results. Other approaches include Bayesian and Monte Carlo tree search over expressions, reinforcement learning (deep symbolic regression, which trains a recurrent network to generate expressions rewarded by fit), and transformer models pretrained to map data directly to equations (see transformers). AI Feynman combines neural network fitting with tests for symmetry, separability and dimensional analysis to break the problem into simpler parts, and solved all 100 equations in a set of Feynman Lectures formulas.
The accuracy–complexity trade-off
Any data set can be fitted exactly by a sufficiently complicated formula, so symbolic regression must balance accuracy against complexity (number of nodes or operators). Most modern tools return a Pareto front of expressions: the simplest equation for each level of accuracy. The user chooses from the front, often at the “knee” where extra complexity brings little improvement in error. Selection criteria include the Akaike and Bayesian information criteria, minimum description length, and cross-validation error. A parsimony penalty discourages bloat, the tendency for expressions to grow without improving fit. Restricting the allowed operators and tree depth to physically meaningful choices, and constraining units with dimensional analysis (so that terms added together have the same units), reduces the search space and avoids meaningless formulas. Prior knowledge, such as known symmetries or limiting behaviors, can be built in as constraints.
Sparse identification of nonlinear dynamics (SINDy)
For discovering differential equations from time series, SINDy (Brunton, Proctor and Kutz, 2016) offers a more direct, less expensive alternative. It assumes that the dynamics dx/dt = f(x) are a sparse combination of terms from a library of candidate functions Θ(x) = [1, x, x2, xy, sin x, …]. Measured derivatives are regressed on the library, Ẋ = Θ(X)Ξ, with a sparsity-promoting method such as sequentially thresholded least squares or the lasso (see regularized linear models), so that most coefficients become zero, leaving a handful of active terms that form the equation. SINDy has recovered the Lorenz equations, fluid-flow models and reaction kinetics from data, and has extensions for partial differential equations (PDE-FIND), systems with control inputs, weak formulations that tolerate noise, and ensembles for uncertainty. Quality depends on accurate derivative estimates, a library that contains the true terms, and low noise, so smoothing or integral forms are often needed.
Validation and interpretation
Because many different expressions can fit similarly well, careful validation is needed. Evaluate candidates on held-out data, ideally including extrapolation to new conditions, and check that residuals look like noise. Test robustness to noise and to different random seeds, and examine whether the same structure appears repeatedly. Check units, limiting cases (does it behave sensibly as a variable goes to 0 or infinity?), and whether the equation agrees with known theory or can be given a physical meaning. A formula that fits is a hypothesis to test by new experiments, not a law. Simplify expressions algebraically (SymPy) to remove equivalent forms. Common failure modes are overfitting noise with constants, finding numerically fine but physically meaningless terms, and sensitivity to scaling and to the choice of operators.
Software, typical applications and limits
Limits: heavy computation as problems grow, sensitivity to noise, non-unique answers, difficulty with high-dimensional data (more than about 10 variables) and discovered equations that may extrapolate badly if they only mimic the data.
Basic operation
- Prepare the data. Clean it, note units and noise, and split off a held-out test set.
- Choose building blocks. Select variables, operators and a maximum complexity that make physical sense.
- Add constraints. Include units, symmetries and known limits if available.
- Run the search. Evolve expressions and fit constants, using several random seeds.
- Inspect the Pareto front. Compare accuracy and complexity of candidate equations.
- Validate. Test on held-out and extrapolation data, and check residuals and limits.
- Simplify and interpret. Reduce the expression and relate terms to physical meaning.
- Collect the output. You obtain candidate equations with error and complexity; library design for SINDy and noise handling are covered in the video.
Good practice
- Prefer simple equations. Use the knee of the Pareto front.
- Use units. Dimensional consistency removes many false formulas.
- Test beyond the data. Check extrapolation and limiting cases.
- Repeat the search. Stable structure across seeds is more credible.
- Treat results as hypotheses. Confirm with new experiments.
- Do not overstate discoveries. A fitted formula is not a proven law, so describe it as an empirical model with its range of validity, particularly before using it in engineering design or safety calculations.
Key terms
- Expression tree — a tree representation of a formula with operators and operands.
- Genetic programming — evolving populations of programs or formulas by selection, crossover and mutation.
- Pareto front — the set of best trade-offs between error and complexity.
- Parsimony — a preference for the simplest adequate model.
- SINDy — sparse regression over a library of functions to find governing equations.
- Dimensional analysis — checking that formula terms have consistent physical units.
- Bloat — growth of expression size without improved accuracy.
Video coming soon
About five minutes on Symbolic regression: how it works in detail, how the data is acquired, and how it is analyzed.
More in 4.3 AI and Machine Learning
- Regularized linear models
- Decision trees and random forests
- Gradient boosting (XGBoost)
- Support vector machines
- k-NN
- k-means
- Gaussian processes
- Neural networks
- CNNs
- RNN/LSTM
- Transformers
- Autoencoders
- GANs
- Diffusion models
- Graph neural networks
- Reinforcement learning
- Transfer learning
- Federated learning
- Explainable AI (SHAP, LIME)
- Physics-informed neural networks
- Bayesian optimization
- Active learning
- Symbolic regression
- Genetic algorithms and particle swarm optimization
- Dimensionality reduction (t-SNE, UMAP)
- NLP and large language models
- Retrieval-augmented generation
- Computer vision (detection, segmentation)
- Anomaly detection
- Machine-learned interatomic potentials
- AutoML
