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.
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
It is a bit cumbersome to ask users to ask users to manually set df["objective"]. However, the only alternative I could think of was to pass in a callable that takes in the dataframe or an EliteBatch and then returns new values to plot. However, this is equally cumbersome as users need to understand the callable format in addition to the dataframe structure.
It is possible that users pass in a "corrupted" dataframe, e.g., one that has out-of-bounds indices. However, for now, I believe it is reasonable to assume users will only get dataframes from as_pandas() and will not perform operations that introduce such entries. In the future, we can add validation checks if this becomes an issue.
Description
This PR seeks to solve two issues:
as_pandas()
on an archive and stored an old dataframe, we may want to plot that dataframe afterwards, e.g., during our data analysis.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, whiledf
provides the content that is plotted. Thisdf
may be retrieved from an earlier call toas_pandas
on the archive, thus resolving Issue 1. Furthermore, users can replacedf["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
df["objective"]
. However, the only alternative I could think of was to pass in a callable that takes in the dataframe or an EliteBatch and then returns new values to plot. However, this is equally cumbersome as users need to understand the callable format in addition to the dataframe structure.as_pandas()
and will not perform operations that introduce such entries. In the future, we can add validation checks if this becomes an issue.TODO
df
param to all visualization functionsQuestions
Status
yapf
pytest
pylint
HISTORY.md