MilesCranmer / PySR

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

[Feature]: Plotting utilities #300

Open MilesCranmer opened 1 year ago

MilesCranmer commented 1 year ago

Feature Request

It would be useful to have some default plot utilities. These could go into pysr.contrib.plot, and could have different user-contributed plotting scripts.

One I usually like to do is error vs complexity, with a log scale for both. I then label a few select points with LaTeX'd equations. It would be cool if there was a utility function to do this automatically.

If anybody is interested in adding some plotting utils, I would warmly welcome a PR!

Slightly related to #126 although that one is specifically automatic plotting. This one would be optional.

w2ll2am commented 11 months ago

I would be interested in helping add this. Do you have a preference of how this might be implemented E.g. specific colour maps in seaborn, only using pure MatPlotLib?

Also I just to clarify I would start by adding two graphs initially:

  1. The data plotted on the same graph as the fitted function. As described in #126. If so how best could I plot multiple independent variables for a given funciton?
  2. Error vs complexity with a log scale of the symbolic regression. Equations for significant points added as labels to the points e.g. minimum error.
MilesCranmer commented 10 months ago

I think both of these are good ideas! I wonder if it could actually be done interactively, rather than statically? Sort of like Eureqa used to do before it became proprietary: IMG_0240

Not the whole interface obviously, but maybe different equations plotted together, which would let you highlight their predictions by clicking them? Would be nice to have it JavaScript based (like plotly.js) so it’s universally compatible.