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

Add script for visualizing RaFTS predictions of performance metrics #32

Closed
wants to merge 7 commits into from

Conversation

bolotinl
Copy link
Collaborator

A new script allows the user to plot a map of RaFTS predicted module performance and/or a scatter plot comparing RaFTS predicted performances to actual performances

Additions

  • Script fs_perf_viz.py, which just requires a viz_config.yaml
  • viz_config.yaml

Testing

The viz_config.yaml should require little to no customization, though it is customizeable in terms of which plots will be generated.

  1. python fs_perf_viz.py "/full/path/to/viz_config.yaml"

Todos

  • Finish and commit .ipynb that demonstrates the utility of fs_perf_viz.py (in progress)

Copy link
Collaborator

@glitt13 glitt13 left a comment

Choose a reason for hiding this comment

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

Hi @bolotinl, I didn't try running this yet, but have some suggestions. Let's chat on your availability to work through these.

pkg/fs_algo/fs_algo/fs_perf_viz.py Outdated Show resolved Hide resolved
plt.title("Predicted Performance: {}".format(ds), fontsize = 28)

# Save the plot as a .png file
output_path = f'{dir_out}/data_visualizations/{ds}_{algo}_{metric}_performance_map.png'
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest we 1) create a function for writing data visualization files and 2) a function for generating the data visualization directory and filepath (e.g. std_viz_path). 1) When we switch to the cloud, we'll know to modify the read/write functions to provide a) local read/write or b) cloud read/write (no need to develop this yet). 2) A single function to create the file path will eliminate guesswork on filenames when reading whatever was written. Prioritize item #2 and we can get back to #1 if you're limited in time - we'll need a major overhaul to prepare for cloud integration.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Return a matplot lib figure as an object (plt.gcf())
Create functions that define paths
Create functions that do the file I/O so that when we migrate to AWS we can just update the function
Move the creation of the data_visualizations folder into a function that creates the path for it
dir_ * if a directory
path_* if a path
Could include smaller functions for creating the path to the performance map, for example: fsate lines 492, 474
Look at plot learning curve for example: https://github.com/glitt13/formulation-selector/blob/agu_24/pkg/fs_algo/fs_algo/fs_algo_train_eval.py

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Classes are mostly for conveniently passing along data, so you can probably just do functions for now and either make a separate plotting file or add to fsate

pkg/fs_algo/fs_algo/fs_perf_viz.py Show resolved Hide resolved
pkg/fs_algo/fs_algo/fs_perf_viz.py Outdated Show resolved Hide resolved
pkg/fs_algo/fs_algo/fs_perf_viz.py Outdated Show resolved Hide resolved
pkg/fs_algo/fs_algo/fs_perf_viz.py Show resolved Hide resolved
pkg/fs_algo/fs_algo/fs_perf_viz.py Outdated Show resolved Hide resolved
plt.title('Observed vs. Predicted Performance: {}'.format(ds))

# Save the plot as a .png file
output_path = f'{dir_out}/data_visualizations/{ds}_{algo}_{metric}_obs_vs_sim_scatter.png'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this is a different visualization, seems like the std_viz_path function could use the true_keys object for creating the full file name.

plt.title('Observed vs. Predicted Performance: {}'.format(ds))

# Save the plot as a .png file
output_path = f'{dir_out}/data_visualizations/{ds}_{algo}_{metric}_obs_vs_sim_scatter.png'
Copy link
Collaborator

Choose a reason for hiding this comment

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

@bolotinl A new suggestion - create a subdirectory based on the dataset inside output/data_visualizations, mimicking the structures created by fs_algo_train_eval.std_pred_path, e.g.

Path(dir_out)/Path('data_visualizations')/Path(dataset_id)/Path(insert specific plottype_algo_metric_dataset_id here)

@bolotinl bolotinl closed this Dec 18, 2024
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