Metadata-Version: 2.5
Name: eqdisco
Version: 1.0
Summary: Equation discovery in Python: genetic programming, GP-OLS, symbolic regression, sparse and Bayesian structure identification, SINDy and NARX models, physical units and shape constraints, simplification, uncertainty, sensitivity, visualization, code export and MLOps for symbolic models.
Project-URL: Homepage, https://github.com/ComplexSystemsIntelligence/eqdisco
Project-URL: Documentation, https://complexsystemsintelligence.github.io/eqdisco
Project-URL: Repository, https://github.com/ComplexSystemsIntelligence/eqdisco
Project-URL: Issues, https://github.com/ComplexSystemsIntelligence/eqdisco/issues
Project-URL: Changelog, https://github.com/ComplexSystemsIntelligence/eqdisco/blob/main/CHANGELOG.md
Project-URL: Book (PDF), https://complexsystemsintelligence.github.io/eqdisco/eqdisco-book.pdf
Author-email: János Abonyi <janos@abonyilab.com>
License-Expression: MIT
License-File: LICENSE
Keywords: GP-OLS,MLOps,NARX,SINDy,equation discovery,genetic programming,interpretable machine learning,model selection,orthogonal least squares,scientific machine learning,symbolic regression,system identification
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.10
Requires-Dist: matplotlib>=3.7
Requires-Dist: networkx>=3.0
Requires-Dist: numpy>=1.24
Requires-Dist: pandas>=2.0
Requires-Dist: scikit-learn>=1.3
Requires-Dist: scipy>=1.11
Requires-Dist: sympy>=1.12
Provides-Extra: all
Requires-Dist: mlflow>=2.8; extra == 'all'
Requires-Dist: plotly>=5.15; extra == 'all'
Provides-Extra: book
Requires-Dist: beautifulsoup4>=4.12; extra == 'book'
Requires-Dist: lxml; extra == 'book'
Requires-Dist: pillow; extra == 'book'
Provides-Extra: dev
Requires-Dist: build; extra == 'dev'
Requires-Dist: myst-parser; extra == 'dev'
Requires-Dist: numpydoc; extra == 'dev'
Requires-Dist: plotly>=5.15; extra == 'dev'
Requires-Dist: pydata-sphinx-theme; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest>=7; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Requires-Dist: sphinx-copybutton; extra == 'dev'
Requires-Dist: sphinx-design; extra == 'dev'
Requires-Dist: sphinx-gallery>=0.15; extra == 'dev'
Requires-Dist: sphinx>=7; extra == 'dev'
Requires-Dist: twine; extra == 'dev'
Provides-Extra: docs
Requires-Dist: myst-parser; extra == 'docs'
Requires-Dist: numpydoc; extra == 'docs'
Requires-Dist: plotly>=5.15; extra == 'docs'
Requires-Dist: pydata-sphinx-theme; extra == 'docs'
Requires-Dist: sphinx-copybutton; extra == 'docs'
Requires-Dist: sphinx-design; extra == 'docs'
Requires-Dist: sphinx-gallery>=0.15; extra == 'docs'
Requires-Dist: sphinx>=7; extra == 'docs'
Provides-Extra: interactive
Requires-Dist: plotly>=5.15; extra == 'interactive'
Provides-Extra: mlflow
Requires-Dist: mlflow>=2.8; extra == 'mlflow'
Provides-Extra: test
Requires-Dist: pytest-cov; extra == 'test'
Requires-Dist: pytest>=7; extra == 'test'
Description-Content-Type: text/markdown

<p align="center"><img src="https://raw.githubusercontent.com/ComplexSystemsIntelligence/eqdisco/main/docs/_static/banner.png" alt="eqdisco: discovering equations from data in Python"></p>

# eqdisco: discovering equations from data in Python

[![tests](https://github.com/ComplexSystemsIntelligence/eqdisco/actions/workflows/ci.yml/badge.svg)](https://github.com/ComplexSystemsIntelligence/eqdisco/actions/workflows/ci.yml)
[![docs](https://img.shields.io/badge/docs-gallery%20%2B%20API-285780)](https://complexsystemsintelligence.github.io/eqdisco)
[![book](https://img.shields.io/badge/book-PDF%20%C2%B7%20EPUB%20%C2%B7%20web-D55E00)](https://complexsystemsintelligence.github.io/eqdisco/book.html)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/ComplexSystemsIntelligence/eqdisco/blob/main/LICENSE)

**eqdisco** searches the space of mathematical expressions for equations that
explain data, and then helps to understand, check and deploy what it found. It
grew out of the GP-OLS MATLAB toolbox of Madár, Abonyi and Szeifert
([Ind. Eng. Chem. Res. 44(9), 3178–3186, 2005](https://doi.org/10.1021/ie049626e)),
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 — tree-based genetic programming with parameter
optimization and multi-objective selection, multi-gene GP, sparse regression
(SINDy, FFX), exhaustive and Bayesian search, grammar-based cross-entropy search,
and LLM-proposed expressions — and adds tools for domain knowledge, model
analysis and MLOps. All estimators follow the scikit-learn API.

| Module | Contents |
|---|---|
| `eqdisco.expr`, `eqdisco.equation` | prefix-tree `Expression` with protected primitives, analytic parameter Jacobian, interval arithmetic and SymPy conversion; the fitted `Equation` (predict, metrics, LaTeX, JSON) |
| `SymbolicRegressor`, `SymbolicClassifier` | tree GP: ramped half-and-half or PTC2 initialization, subtree/point/hoist/shrink/semantic variation, linear scaling, Levenberg–Marquardt parameter optimization, tournament, double-tournament, ε-lexicase, NSGA-II and age–fitness Pareto selection, islands, Pareto archive and model selection by BIC, knee, PySR score or validation |
| `MultiGeneRegressor`, `GPOLSRegressor`, `CooperativeOLSRegressor` | multi-gene GP; GP-OLS with error-reduction-ratio pruning; new: ERR-guided variation and a cooperative OLS–GP term library |
| `SymbolicTransformer` | goal-oriented symbolic projections (Sammon, Fisher, neighbourhood, target) after Dörgő, Kulcsár and Abonyi (2021) |
| `SparseRegressor`, `FFXRegressor` | STLSQ, Lasso, FROLS and best-subset regression on polynomial, function and hinge libraries; fast function extraction |
| `ExhaustiveRegressor`, `BayesianSymbolicRegressor`, `GrammarCERegressor`, `LLMGuidedRegressor` | enumeration with MDL selection; Bayesian machine scientist with parallel tempering; risk-seeking grammar cross-entropy search (new); a provider-independent protocol for language-model proposals |
| `eqdisco.dynamics` | NARX regressors and free-run simulation, order scan, derivative estimation, `SINDy`, `SymbolicODE`, `ODEModel` |
| `eqdisco.knowledge` | SI units and dimensional consistency, Buckingham Π, shape constraints by sampling or interval arithmetic, separability and symmetry tests on a neural surrogate |
| `eqdisco.simplify`, `eqdisco.analysis` | rule-based and SymPy simplification, coefficient rounding; Pareto tools, cross-validation of searches, residual diagnostics, Wald/profile/bootstrap intervals, Sobol indices, building blocks, variable interaction networks, model families |
| `eqdisco.viz`, `eqdisco.interactive` | trees, typeset equations, Pareto fronts, convergence, parity and residual plots, partial dependence, sensitivity, ERR paths, families, phase portraits, prediction bands, dashboards; plotly twins |
| `eqdisco.export`, `eqdisco.mlops` | code generation for Python, NumPy, C, MATLAB, Julia, Excel and LaTeX; PMML 4.4 and JSON; model registry, model cards, run tracker (optional MLflow), drift monitor |
| `eqdisco.datasets`, `eqdisco.benchmarks` | Nguyen, Koza, Keijzer, Vladislavleva, Pagie, Friedman and Feynman problems; Kepler, thermal runaway and dynamical systems; benchmark runner with the SRBench solution criterion |

## Installation

```bash
pip install eqdisco
```

Python ≥ 3.10; depends on numpy, scipy, sympy, scikit-learn, pandas, networkx
and matplotlib. `pip install "eqdisco[all]"` adds plotly and MLflow.

## Quick start

```python
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

rng = np.random.default_rng(0)                            # GP-OLS: terms, weights, ERR
X = rng.normal(size=(300, 3))
y = 1.5 * X[:, 0] * X[:, 1] - 0.8 * X[:, 2] ** 2
gp = eq.GPOLSRegressor(generations=20, random_state=0).fit(X, y)
print(gp.gene_table())

print(eq.export.to_c(sr.equation_))                       # deployable code
```

## Documentation and book

* Documentation, gallery of 41 runnable examples and API reference:
  <https://complexsystemsintelligence.github.io/eqdisco>
* The companion book, *Discovering Equations from Data with Python: Symbolic
  regression, genetic programming and the eqdisco toolbox* (CC BY 4.0):
  [PDF](https://complexsystemsintelligence.github.io/eqdisco/eqdisco-book.pdf),
  [EPUB](https://complexsystemsintelligence.github.io/eqdisco/eqdisco-book.epub),
  [web edition](https://complexsystemsintelligence.github.io/eqdisco/book/index.html)

## Citing

Please cite the toolbox and the original publications of the methods you use (see `CITATION.cff`):

> J. Abonyi, *eqdisco: equation discovery, symbolic regression and genetic programming in Python*, version 1.0, 2026.
>
> J. Madár, J. Abonyi, F. Szeifert, Genetic programming for the identification of nonlinear input–output models, *Industrial & Engineering Chemistry Research* 44(9) (2005) 3178–3186, doi:10.1021/ie049626e.

## Acknowledgments

Developed at the University of Pannonia, Veszprém, by the
[Complex Systems Intelligence](https://complexsystemsintelligence.github.io) group
([abonyilab.com](https://www.abonyilab.com)). The package builds on the GP-OLS
toolbox of János Madár, János Abonyi and Ferenc Szeifert and on the genetic
programming studies of Alex Kummer, Tamás Varga, Gyula Dörgő and Tibor Kulcsár.
The research was supported by the National Research, Development and Innovation
Office of Hungary (NKFIH) through the OTKA 143482 project.

## License

MIT for the software; CC BY 4.0 for the book.
