About this project
PySR is an open-source tool for symbolic regression — a machine learning task that finds interpretable symbolic expressions optimizing a given objective. Built alongside the Julia library SymbolicRegression.jl, it serves as the search engine powering PySR's capabilities.
Installation is straightforward via pip or conda-forge. Julia dependencies are installed automatically on first import. PySR also supports containerized deployment through Docker and Apptainer for cluster environments without root access.
The main interface follows scikit-learn conventions via `PySRRegressor`. Users specify search parameters including maximum expression size, number of iterations, binary and unary operators, custom loss functions (written in Julia syntax), and model selection strategies. The search engine performs hundreds of thousands of mutations and equation evaluations across configured iterations.
Key features include:
- Custom operators defined in Julia syntax (e.g., `inv(x) = 1/x`)
- Custom elementwise loss functions
- Denoising mode (`denoise=True`)
- Feature selection (`select_k_features=N`)
- Warm start support to resume interrupted searches
- Equation export in multiple formats: callable lambda, SymPy, JAX (differentiable), and PyTorch (differentiable)
- Nested operator constraints for controlling expression complexity
- Multi-node cluster support via Slurm cluster manager
- Hall of fame CSV and PKL serialization for saved model states
PySR also supports symbolic distillation of neural networks — converting trained neural nets into analytic equations, providing an interpretable way to understand deep learning models. This approach is described in the associated research papers available on arXiv.
Comments
0 people shared their preference · Deer Point appears after 10 participants
Sign in to join the discussion.