← all repositories
astroautomata/PySR

Turn your data into actual math

PySR hunts for human-readable equations that fit your data, using a Julia-backed genetic search engine wrapped in a scikit-learn interface.

3.6k stars Python ML FrameworksOther AI
PySR
Velocity · 7d
+1.3
★ / day
Trend
steady
star history

What it does

PySR performs symbolic regression: it searches through the space of mathematical expressions to find compact, interpretable formulas that predict your target variable. You feed it tabular data; it returns candidate equations ranked by accuracy and complexity, complete with SymPy, JAX, and PyTorch representations.

The interesting bit

The heavy lifting happens in Julia via SymbolicRegression.jl, while the API stays comfortably Pythonic. This two-language design lets you write model.fit(X, y) in Python while a multithreaded evolutionary search runs in Julia. The project also explores “symbolic distillation” — extracting analytic equations from trained neural networks to make black-box models legible.

Key highlights

  • scikit-learn-compatible PySRRegressor with fit, predict, and score
  • Custom operators and loss functions written in Julia syntax passed through Python strings
  • Built-in feature selection (select_k_features) and denoising options
  • Exports discovered equations to SymPy, JAX, and PyTorch for downstream use
  • Warm-start support: resume search from previous hall_of_fame checkpoint
  • Pareto frontier of equations balancing loss against complexity, with configurable selection strategy

Caveats

  • Best suited for low-dimensional datasets; high-dimensional problems may need neural-network preprocessing
  • Julia dependency can trigger libstdc++ version conflicts on Linux (documented in troubleshooting)
  • warm_start=True breaks if you change operators or other search parameters between runs

Verdict

Worth a look if you need explainable models for physics, chemistry, or any domain where “a neural net said so” isn’t enough. Skip it if you just need prediction accuracy and don’t care about the shape of the underlying function.

Frequently asked

What is astroautomata/PySR?
PySR hunts for human-readable equations that fit your data, using a Julia-backed genetic search engine wrapped in a scikit-learn interface.
Is PySR open source?
Yes — astroautomata/PySR is open source, released under the Apache-2.0 license.
What language is PySR written in?
astroautomata/PySR is primarily written in Python.
How popular is PySR?
astroautomata/PySR has 3.6k stars on GitHub and is currently holding steady.
Where can I find PySR?
astroautomata/PySR is on GitHub at https://github.com/astroautomata/PySR.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.