icaros-usc / pyribs

A bare-bones Python library for quality diversity optimization.
https://pyribs.org
MIT License
208 stars 34 forks source link

Enable plotting custom data in visualizations #374

Closed btjanaka closed 1 year ago

btjanaka commented 1 year ago

Description

This PR seeks to solve two issues:

  1. Plotting data from old archives. For instance, if we previously called as_pandas() on an archive and stored an old dataframe, we may want to plot that dataframe afterwards, e.g., during our data analysis.
  2. Plotting custom data that is not necessarily the objective. For instance, #195 requests plotting metrics that are not necessarily the objective. Another reasonable case is that we have stored some metric in our metadata and wish to plot it instead of the objective.

I propose that these two issues are really the same issue. In particular, both of these are asking to visualize custom data that are not currently in the archive. Issue 1 wants to plot old data, and Issue 2 wants to plot data with a different objective.

Thus, this PR adds a single parameter, df, that can be used to change the data that is plotted. Essentially, when this parameter is provided, the archive only provides configurations like the upper/lower bounds of the measure space and the cell boundaries, while df provides the content that is plotted. This df may be retrieved from an earlier call to as_pandas on the archive, thus resolving Issue 1. Furthermore, users can replace df["objective"] on their own, thus resolving Issue 2. This feature also allows a user to plot data after performing operations on the dataframe; for instance, one could filter the dataframe and plot the X highest performing solutions.

Caveats

TODO

Questions

Status