astroautomata/PySR

Symbolic Learning in Python and Julia

What it solves

PySR solves the problem of finding interpretable, analytic equations that fit a dataset. Unlike standard machine learning models that act as "black boxes," PySR performs symbolic regression to discover the actual mathematical expression that optimizes a given objective, making the underlying relationship between variables explicit.

How it works

PySR provides a Python interface to a high-performance search engine written in Julia (SymbolicRegression.jl). It uses a multithreaded search process involving hundreds of thousands of mutations and equation evaluations to find the best-fitting symbolic expression. It can also be used for "Symbolic Distillation," where it converts a complex neural network into a simpler analytic equation to help interpret deep learning models.

Who it’s for

It is designed for researchers and data scientists who need transparent, human-readable mathematical models rather than opaque predictions, particularly those working with low-dimensional datasets or seeking to interpret neural networks.

Highlights

  • Scikit-learn compatible: Uses a familiar .fit() and .predict() API.
  • High Performance: Leverages Julia for the heavy lifting of the symbolic search.
  • ** uma differentiable output**: Can export learned equations to JAX and PyTorch formats.
  • Highly Configurable: Allows users to define custom binary and unary operators, loss functions, and complexity constraints.
  • Integration: Includes a skill for coding agents to use PySR within agentic loops.

Related

  • Project
  • Project
  • Project
  • Project
  • Project