Skip to main content
Ctrl+K

eqdisco

  • Installation
  • Example gallery
  • API reference
  • The book
  • From the GP-OLS MATLAB toolbox
    • Citing
    • Changelog
    • All textbooks
  • GitHub
  • Installation
  • Example gallery
  • API reference
  • The book
  • From the GP-OLS MATLAB toolbox
  • Citing
  • Changelog
  • All textbooks
  • GitHub

Section Navigation

  • First steps: expressions, equations and a first search
    • Expressions: trees, evaluation, derivatives and bounds
    • A first search: Kepler’s third law from the planets
    • The size of the search space and the meaning of complexity
    • Linear scaling: let regression handle offset and scale
  • Genetic programming for symbolic regression
    • Five selection schemes on one problem
    • Bloat and its control
    • Parameter optimization inside the search
    • The Pareto front and the choice of one model
    • Diversity: semantic crossover and islands
    • Library learning: reusing building blocks (new in eqdisco)
  • Linear-in-parameters models: OLS, multi-gene GP and GP-OLS
    • Orthogonal least squares and the error reduction ratio
    • Multi-gene genetic programming
    • GP-OLS: pruning terms by their error reduction ratio
    • ERR-guided variation: an experimental operator (new in eqdisco)
    • Cooperative GP with OLS credit assignment (new in eqdisco)
  • Deterministic search: sparse regression, FFX and exhaustive enumeration
    • Sparse regression over a library of terms
    • Fast Function Extraction (FFX)
    • Exhaustive search with a description length
  • Probabilistic search: Bayesian sampling, grammars and language models
    • Bayesian sampling of model structures
    • Learning a grammar of good expressions (new in eqdisco)
    • Language models as proposal generators
  • Dynamic systems: NARX models and differential equations
    • Nonlinear input–output identification with GP-OLS
    • Model order selection for NARX models
    • Sparse identification of the Lorenz system
    • Differential equations by genetic programming
  • Beyond regression: classification and symbolic features
    • A critical equation for reactor runaway
    • Goal-oriented projection with symbolic features
    • Symbolic features for a soft sensor
  • Prior knowledge: units, shape constraints and symmetries
    • Physical units: dimensional consistency and Buckingham groups
    • Shape constraints for safe extrapolation
    • Separability and symmetries detected from data
  • Analysis of models: simplification, validation, uncertainty, structure
    • Simplification of evolved models
    • Validation and uncertainty of a discovered law
    • Sensitivity analysis of a discovered model
    • Building blocks and variable interactions
    • Model families: how many different models do the data support? (new in eqdisco)
    • Bootstrap ensembles: model uncertainty and stable structure
  • From model to deployment: export, registry, monitoring, benchmarks
    • Exporting equations to code, spreadsheets and PMML
    • Registry, model card and drift monitoring
    • A small benchmark of methods
    • A one-page report of a search
  • Example gallery
  • From model to deployment: export, registry, monitoring, benchmarks
  • A one-page report of a search

Note

Go to the end to download the full example code or to run this example in your browser via Binder.

A one-page report of a search#

plot_dashboard() summarizes a fitted search on one page: the selected equation, its tree, the Pareto front on test data, a parity plot and the convergence of the run. Together with the model card it documents a model for colleagues who did not run the search. The data are Feynman I.12.2, Coulomb’s law \(F=q_1q_2/(4\pi\varepsilon r^2)\), with 0.5 % noise.

import matplotlib.pyplot as plt

import eqdisco as eq

prob = eq.datasets.get_problem("feynman-I.12.2", noise=0.005, n_train=300)

Search and report#

sr = eq.SymbolicRegressor(population_size=400, generations=30, functions=("add", "sub", "mul", "div", "sqrt", "square"), optimize="lm", feature_names=prob.feature_names, random_state=0)
sr.fit(prob.X_train, prob.y_train)
print("selected:  ", sr.equation_)
print("simplified:", eq.simplify.simplify(sr.equation_, prob.X_train, prob.y_train, sympy=True, refit=True, round_digits=True))
print("law recovered (affine, tol 1e-2):", eq.benchmarks.is_symbolic_solution(sr.equation_, prob.truth, X=prob.X_test, affine=True, tol=1e-2))
fig = eq.viz.plot_dashboard(sr, prob.X_train, prob.y_train, prob.X_test, prob.y_test)
plot 41 dashboard
selected:   -5.628e-05 + 1.254 * (q2 - 0.002241) * q1 / r / (-1.984)^2 / (sqrt(r^2) / ((r / (r + r))^2 / ((epsilon * epsilon)^2 * (-2.414e-05) + epsilon)))
simplified: 0.0796 * (q2 - 0.00224) * q1 / r / abs(r) / (-2.41e-05 * (epsilon^2)^2 + epsilon) - 5.63e-05
law recovered (affine, tol 1e-2): True

Parameter study: population size and recovery#

sizes = [100, 200, 400]
hits = []
for mu in sizes:
    h = 0
    for s in range(3):
        m = eq.SymbolicRegressor(population_size=mu, generations=20, functions=("add", "sub", "mul", "div", "sqrt", "square"), optimize="lm", feature_names=prob.feature_names, random_state=s).fit(prob.X_train, prob.y_train)
        h += eq.benchmarks.is_symbolic_solution(m.equation_, prob.truth, X=prob.X_test, affine=True, tol=1e-2)
    hits.append(h)
print("population", sizes, "recoveries of 3", hits)
fig, ax = plt.subplots(figsize=(4, 3))
ax.bar([str(s) for s in sizes], hits, color="#285780")
ax.set_xlabel("population size")
ax.set_ylabel("recoveries (of 3 runs)")
plt.show()
plot 41 dashboard
population [100, 200, 400] recoveries of 3 [2, 1, 3]

Total running time of the script: (0 minutes 46.066 seconds)

Launch binder

Download Jupyter notebook: plot_41_dashboard.ipynb

Download Python source code: plot_41_dashboard.py

Download zipped: plot_41_dashboard.zip

Gallery generated by Sphinx-Gallery

previous

A small benchmark of methods

next

API reference

On this page
  • Search and report
  • Parameter study: population size and recovery
Show Source

© Copyright 2026, János Abonyi.

Created using Sphinx 9.1.1.