Enable plotting custom data in visualizations #374
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
CONTRIBUTING.md
yapf
pytest
pylint
HISTORY.md