Symbolic regression is a form of regression analysis that searches over mathematical expressions to find both the structure and the parameters of a model that fits a data set. Unlike linear or polynomial regression, it does not fix the model form in advance: the algorithm decides whether the answer is a product, a ratio, an exponential or a trigonometric term. In evolutionary computation, it is the classic application of genetic programming, where candidate formulas evolve as expression trees.
The appeal is interpretability. A neural network may predict well but hides its reasoning in millions of weights, whereas symbolic regression returns a compact closed-form equation that a scientist can read, differentiate, check for units and compare with theory. The price is a hard combinatorial search that grows rapidly with formula size.
How symbolic regression searches for formulas
The search works on expression trees, where internal nodes are operators and leaves are input variables or constants. A genetic programming system starts with a random population of trees, evaluates each against the data with a fitness function such as mean squared error, and builds the next generation through selection, subtree crossover and mutation.
The table below lists the building blocks that every symbolic regression setup must define.
| Ingredient | Typical choice | Effect on the search |
|---|---|---|
| Function set | +, -, ×, ÷, sin, exp, log | Defines which formula shapes are reachable |
| Terminal set | Input variables and constants | Determines which inputs can appear |
| Fitness measure | Mean squared error or R² | Defines what counts as a good fit |
| Complexity penalty | Node count or tree depth | Controls formula length and bloat |
| Constant optimization | Gradient descent or Levenberg–Marquardt | Tunes numeric coefficients inside a structure |
Most modern systems separate structure search from coefficient fitting. Evolution proposes the shape of a formula, and a local optimizer sets its constants, because random mutation alone finds precise real-valued coefficients very slowly.
Main approaches and algorithm families
Genetic programming is the historical core of the field, but several alternatives now compete with it. They differ in how they represent formulas and how they explore the space, which affects speed, reliability and the size of formulas they can recover.
| Approach | Representation | Strength | Weakness |
|---|---|---|---|
| Tree-based genetic programming | Expression trees | Flexible, well studied | Bloat and slow convergence |
| Cartesian genetic programming | Directed acyclic graphs | Reuses subexpressions | Fixed grid size to tune |
| Grammatical evolution | Integer strings mapped by a grammar | Enforces syntactic constraints | Weak locality of mutation |
| Sparse regression | Linear combination of library terms | Fast and deterministic | Limited to terms in the library |
| Neural-guided search | Sequences generated by a trained network | Learns priors over formulas | Needs large pretraining effort |
Hybrid systems are common. Many combine evolutionary search with neural priors, or use a sparse library as a starting point for evolution. Benchmarks such as SRBench compare these methods on both accuracy and the exact recovery of known equations.
Accuracy, complexity and the Pareto front
Symbolic regression is inherently multi-objective: a longer formula almost always fits the training data better, yet it generalizes worse and is harder to read. Practitioners therefore report a Pareto front of formulas, each one the best fit for its level of complexity, often computed with a multi-objective evolutionary algorithm such as NSGA-II.
The choice from that front follows a simple pattern, shown below for a typical run.
| Complexity (nodes) | Training error | Interpretation |
|---|---|---|
| 3-5 | High | Too simple, misses key effects |
| 7-15 | Drops sharply | Often the best choice, the knee of the curve |
| 20-40 | Slightly lower | Usually fitting noise |
| Over 50 | Near zero on training data | Overfitting and unreadable |
The knee of the Pareto front, where extra complexity stops buying meaningful accuracy, is the usual selection point. Validation on held-out data and a check that the formula is dimensionally consistent give further protection against spurious equations.
Where symbolic regression is applied
Symbolic regression is most valuable when an explicit formula is worth more than raw accuracy. Typical domains are physics, chemistry, engineering and finance, where an equation can be validated against theory, embedded in a simulator or certified by a regulator.
- Scientific discovery: rediscovering conservation laws or empirical relations from experimental data.
- Surrogate modeling: replacing an expensive simulation with a fast closed-form approximation.
- Control and system identification: finding dynamic equations for controllers.
- Feature engineering: generating nonlinear features for other machine learning models.
The method suits problems with few input variables, typically fewer than about ten, and data of reasonable quality. With hundreds of features or very noisy measurements, the search becomes slow and unstable, and a gradient boosting model or neural network usually predicts better, although it offers no compact equation in return.
Domain knowledge improves results considerably. Restricting the function set to physically plausible operators, supplying known invariants or enforcing unit consistency shrinks the search space and raises the chance of recovering a meaningful law rather than a curve fit. Simple preprocessing, such as scaling inputs and removing obvious outliers, also stabilizes the search.
Limitations and common pitfalls
The search space is enormous, and finding the exact optimal formula is believed to be NP-hard. Results therefore depend on random seeds, operator choice and run time, and two runs may return different but similarly accurate equations. The table lists frequent problems and remedies.
| Symptom | Likely cause | Remedy |
|---|---|---|
| Formulas grow without accuracy gain | Bloat in genetic programming | Add parsimony pressure or depth limits |
| Different formula every run | Flat fitness landscape, noisy data | Run many seeds and compare fronts |
| Numerical errors during evaluation | Division by zero, log of negatives | Use protected operators or interval checks |
| Good fit, poor extrapolation | Overfitting to a narrow input range | Test outside the training range |
A further pitfall is over-trusting a neat formula. A short equation that fits well is a hypothesis, not a discovered law, until it is tested on new data and checked against domain knowledge.
Understanding it simply
Symbolic regression is like a detective that guesses the formula behind a table of numbers. It tries many equations, keeps the ones that match best and mixes their parts to make new guesses.
Ordinary regression asks how steep a straight line should be. Symbolic regression asks a bigger question. It asks what kind of equation describes the data at all. The result is a formula a person can read and check, not a black box.
Applied in practice
A heat-exchanger engineering team has a computational fluid dynamics model that needs about 40 minutes per run. They need thousands of evaluations for design optimization, so they run 600 simulations across flow rate, fin spacing and inlet temperature and feed the results to a genetic programming tool.
After several hundred generations across 20 random seeds, the Pareto front shows a clear knee at a formula with 11 nodes: a power law in flow rate multiplied by a ratio involving fin spacing. It predicts heat transfer within about 3 percent on held-out simulations and matches the form of known empirical correlations.
The team embeds the formula in its optimizer, which now evaluates a design in microseconds. Because the equation is explicit, the engineers can also verify its units and document its validity range for the design review.