skillfed

pysr

Simple and efficient symbolic regression

pysr v1.5.10 98.8K downloads/30d#13,056 on PyPI
Permissive license Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) Active released

What it is and what it does

PySR is a symbolic regression tool that discovers interpretable mathematical expressions fitting your data. Instead of returning a neural network or opaque model, it uses evolutionary search powered by Julia to explore the space of possible equations, combining operators like addition, multiplication, and functions like cosine or exponential. It follows scikit-learn's fit/predict interface, making it familiar to data scientists while offering something fundamentally different: equations you can read, understand, and use analytically.

The package is designed for low-dimensional datasets where interpretability matters more than squeezing out the last percentage point of accuracy. It also supports symbolic distillation—converting trained neural networks into analytic equations—which can help explain deep learning models. Configuration is extensive: you define which operators to search, custom loss functions, complexity penalties, and iteration counts, giving you fine control over the search process.

Use it for:

  • Discover interpretable formulas from experimental physics or chemistry data where understanding the equation matters as much as prediction.
  • Convert a trained neural network into a symbolic equation for scientific interpretation or deployment in resource-constrained environments.
  • Fit low-dimensional datasets where you suspect a simple closed-form relationship exists but don't know its structure.
  • Generate candidate equations for hypothesis testing in scientific research where the model itself is the research output.
  • Reduce model complexity and improve generalization by finding sparse, parsimonious expressions instead of high-degree polynomials.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

PySR searches for symbolic expressions that fit data by combining genetic algorithms with Julia's performance, returning human-readable equations instead of black-box models.

Yes, if you work with low-dimensional data where interpretability is a priority or you need to extract equations from neural networks. The active maintenance, permissive license, low install friction, and scikit-learn-compatible interface make it a solid choice. Not recommended if you need black-box performance on high-dimensional datasets or require guaranteed convergence to a global optimum.

Install

pysr on PyPI

pip

pip install pysr

uv

uv add pysr

poetry

poetry add pysr

Installing pysr

Before you install

Low friction install with a pure Python wheel; Julia dependencies install automatically on first import. Actively maintained with recent releases.

License in practice

Apache 2.0 permissive license allows commercial and private use with minimal restrictions; you may modify and distribute derivative works provided you include license notices.

Quickstart

pip install pysr

import numpy as np
from pysr import PySRRegressor

X = np.random.randn(100, 5)
y = 2.5 * np.cos(X[:, 3]) + X[:, 0] ** 2

model = PySRRegressor(maxsize=20, niterations=40, binary_operators=["+", "*"], unary_operators=["cos", "sin"])
model.fit(X, y)
print(model.predict(X))

Requires Julia to be installed or will download it on first import; LD_LIBRARY_PATH conflicts with other Python packages loading libstdc++ may require manual configuration.

Verify before relying

  • Whether the package handles datasets larger than typical low-dimensional symbolic regression benchmarks without significant performance degradation.
  • Specific performance characteristics or memory requirements for typical use cases.
  • Whether custom loss functions and operators are fully documented and stable across versions.

Package facts

License Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 7 — click, juliacall, numpy, pandas, scikit-learn, sympy, typing-extensions
Maintenance actively maintained — 137 days since the last release
First released
Downloads 98,850/month — #13,056 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pysr-1.5.10-py3-none-any.whl

License :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

symbolic regressionequation discoveryinterpretable machine learninggenetic algorithm fittingsymbolic distillation neural networksformula fittingexpression search
symbolic-regressioninterpretable-mlequation-discovery

More Artificial Intelligence packages