MilesCranmer / PySR

High-Performance Symbolic Regression in Python and Julia
https://astroautomata.com/PySR
Apache License 2.0
2.32k stars 211 forks source link

BREAKING: Disable automatic sympy simplification #658

Closed MilesCranmer closed 3 months ago

MilesCranmer commented 3 months ago

Fixes #656 by @tbuckworth

This is also the "right thing to do" for other reasons. sympify shouldn't simplify automatically, the user should do it explicitly, otherwise they might be surprised by it being different. Avoiding automatic simplification also reduces the need for extra sympy mappings. This often comes from sympy automatically interpreting things as symbolic, like exp(1.0) == e. This will now be treated as actually exp of 1.0.

Also adds sympy.NumberSymbol support in both sympy2jax and sympy2torch with new tests.