PySR searches for short symbolic formulas that fit tabular data. It exposes a scikit-learn style API and exports results to SymPy, JAX, or PyTorch.
Overview
PySR performs symbolic regression: it evolves mathematical expressions that minimize error on a dataset while staying readable. A Julia search engine backs the Python package, and training launches a multithreaded search that logs candidate equations as it runs.
Developers construct a PySRRegressor with operators, complexity limits, and iteration counts, then call fit on NumPy arrays. Predictions use the auto-selected equation or a chosen index, and model.equations stores callable, SymPy, JAX, and PyTorch forms. Warm start can resume hall-of-fame checkpoints saved to CSV and pickle files.
The project targets low-dimensional data and supports feature selection, denoising, and extensive operator constraints documented in the options reference. Docker and Apptainer recipes exist for containers, and installation is via pip or conda with Julia dependencies resolved on first import.
Symbolic regression can also distill neural networks into explicit formulas, as described in linked research on N-body problems. An agent skill package helps coding assistants use PySR inside larger workflows.
Key features
- Symbolic regression with evolutionary search
- scikit-learn compatible PySRRegressor API
- SymPy JAX and PyTorch export formats
- Configurable operators and complexity limits
- Parallel Julia backend from Python
- Hall-of-fame checkpoint CSV and pickle saves
- Feature selection and denoising options
- Docker and Apptainer container workflows
Use cases
- Discovering compact equations from measurements
- Explaining low-dimensional lab or simulation data
- Converting trained neural nets to formulas
- Running regression jobs in shared clusters