Change the ordering of how sympy mappings are collected so that user-defined mappings override existing ones
#864
Closed
romanovzky
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
|
That’s a really great point! Yes I am all for that. In fact I’d even consider the current behavior a bug; so this is very worth changing. (Happy to take a PR if you have time; otherwise I will eventually get to it) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
In #856 a problem with the
cbrtfunction led to a redefinition of thesympymapping here #858 . While this solved the problem of usingmodel.predict, the new mapping is cumbersome to read insympyorlatexform, making it hard to reuse the expression downstream.A simple solution for this would be to change the mapping back to
sympy.cbrtto force nice looking expressions forlatexand other applications outside the python API. However, this is difficult to do without the user writing their own parsing function to emulate the functionality of https://github.com/MilesCranmer/PySR/blob/master/pysr/export_sympy.py.A simple solution would be to change in
PySR/pysr/export_sympy.py
Line 81 in 871a710
to
this way, the
extra_sympy_mappignswould override the internal ones (sympy_mappings), allowing for the user to change thecbrtto a more readable format after training and validating the result using the python API.This change would also allow users to have more control over the
sympymappings used beyond the specific problem that I've encountered.Beta Was this translation helpful? Give feedback.
All reactions