eqdisco: discovering equations from data#
eqdisco searches the space of mathematical expressions for equations that explain data, and then helps to understand, check and deploy what it found. It is the Python successor of the GP-OLS MATLAB toolbox of Madár, Abonyi and Szeifert (Ind. Eng. Chem. Res., 2005), in which genetic programming proposes the structure of a linear-in-parameters model and orthogonal least squares prunes the terms that do not contribute. Around this method the package collects the families of symbolic regression that have proved themselves in the literature, adds several new ones, and provides tools for domain knowledge, model analysis and MLOps. Every estimator follows the scikit-learn API.
Tree GP with linear scaling, Levenberg–Marquardt constants, lexicase, NSGA-II and age–fitness Pareto selection, islands, model selection.
Linear-in-parameters models, error reduction ratios, OLS pruning, ERR-guided variation and the cooperative OLS–GP library.
STLSQ, Lasso, FROLS and best subset on term libraries; FFX; enumeration of all small expressions with MDL selection.
The Bayesian machine scientist, risk-seeking grammar cross-entropy search, and a safe protocol for expressions proposed by language models.
NARX identification with GP-OLS, order selection, free-run simulation, SINDy and symbolic ODEs.
Critical-equation classifiers and goal-oriented symbolic projections for visualization and soft sensors.
Units and dimensional consistency, Buckingham Π, shape constraints, separability and symmetry tests.
Simplification, validation, confidence and prediction intervals, Sobol indices, building blocks, model families, ensembles.
Code generation, PMML, model registry and cards, drift monitoring, benchmarks, one-page reports.
Quick start#
import numpy as np
import eqdisco as eq
planets = eq.datasets.load_kepler() # semi-major axis a, period T
sr = eq.SymbolicRegressor(population_size=300, generations=25, feature_names=["a"],
functions=("add", "sub", "mul", "div", "sqrt"), random_state=0)
sr.fit(planets[["a"]].to_numpy(), planets["T"].to_numpy())
print(sr.equation_) # 0.003055 + 0.9994 * sqrt(a) * a
eq.viz.plot_pareto(sr) # accuracy against complexity
print(eq.export.to_c(sr.equation_)) # deployable code