Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plot equation properties #175

Closed
wants to merge 7 commits into from
Closed

Conversation

Pablo-Lemos
Copy link

Similar to #156, as you suggested @MilesCranmer

pysr/sr.py Outdated Show resolved Hide resolved
pysr/sr.py Outdated Show resolved Hide resolved
pysr/sr.py Outdated

Parameters
----------
threshold : float
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are out of order. Also, fontsize is missing.

More generally, it would be good to add **kwargs to the plotting function to tweak the other settings.

pysr/sr.py Outdated
ax.set_xticklabels(complexities_plot);

# label on the axis:
ax.set_xlabel('Complexity ', fontsize=10);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't use the fontsize variable.

Parameters
----------
threshold : float
The plotting threshold. Plots only equations that with a score
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this metric is too restrictive. Would be better to simply plot all equations (default) or a user-passed list of indices.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think plotting all will be too much of a mess (in most cases). I could change it to "number of equations to plot?"

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that is a good idea! Then the default would be, say, 5 equations - the 5 with the highest score. If there are less than 5 equations, it would be equal to the number of equations. (i.e., the parameter would be default to None and the number inferred).

@MilesCranmer
Copy link
Owner

Thanks, added some comments. Also, after those - could you add a unit-test to make sure it works as expected?

pysr/sr.py Outdated Show resolved Hide resolved

if ax is None:
import matplotlib.pyplot as plt
ax = plt.gca()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think plt.gca() just gets the current/last axis, rather than creating a new one. But I think we would want this to generate a new figure/axis.

@MilesCranmer
Copy link
Owner

MilesCranmer commented Aug 13, 2022

Maybe call it plot_score? Calling it histogram is a bit misleading since histogram is specifically for plotting distributions, whereas this is a bar plot.

Actually, I like plot_equations better, since it could allow for plotting score and loss.

@MilesCranmer MilesCranmer changed the title First version of plotting function Plot equation properties Aug 13, 2022
@MilesCranmer
Copy link
Owner

Actually, I wonder if it would be better to allow the user to specify what column they wish to plot? i.e., y="score" for plotting the score of each equation or y="loss" for plotting the losses. I don't see a reason to have them in separate functions, so one function is probably better.

@MilesCranmer
Copy link
Owner

Closing this as the upcoming tensorboard support will make this much easier to set up. Likely need to rewrite with that in mind (I will take care of this). Thanks @Pablo-Lemos!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants