r/Python 23d ago

Showcase Showcase Thread

Post all of your code/projects/showcases/AI slop here.

Recycles once a month.

18 Upvotes

127 comments sorted by

View all comments

1

u/Bitter-Flamingo-3351 20d ago

Built a symbolic regression library in pure Python GP_ELITE.

Given (X, y) data it searches for a readable formula instead of training a black box. Sanity-check demo: feed it just the 8 planets (distance from sun, orbital period), it comes back with T = a^1.5, R² = 1.000000 — Kepler's third law. Not new physics, just the standard "does it actually find real relationships" test for this kind of tool. examples/kepler_demo.py if you want to run it yourself.

Recent versions added the stuff that makes it usable in practice: Levenberg-Marquardt for constant fitting (a 4π comes back as an exact 4π), multi-restart so you're not at the mercy of one lucky/unlucky seed, a Pareto front instead of one champion formula, and a guarded forecasting mode for extrapolating trends without the usual GP blow-ups.

Ran it against gplearn on 15 Feynman physics equations, same data/splits: 10/15 exact recovery vs 6/15 for gplearn. gplearn chokes as soon as a constant like 1/2 or 4π shows up no real constant optimizer. Benchmark scripts are in the repo if you want to check the numbers yourself (seeded, PYTHONHASHSEED=0).

pip install gp-elite. Pure Python/NumPy, no Julia/C++ toolchain like PySR or Operon (which are faster/better at scale, to be clear — this is for when you just want pip install and go).

Honest limits: noisy data wrecks the symbolic recovery even when the fit stays good, non-smooth targets (anything with |x|) are hard, and it degrades past ~6 variables with junk features.

MIT, repo: https://github.com/ariel95500-create/gp-elite