You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds a new attribute data_dump_file to Xopt which will automatically dump Xopt.data to a user specified CSV file while running. This avoids users having to parse the YAML file generated from dump_file and extracting their data. Full list of changes:
New attribute data_dump_file for a CSV file dumped during .run()
Rename dump_file to xopt_dump_file to avoid ambiguous name with new attribute.
Add legacy support for old name with deprecation warnings to update
Before validator for existing config files
Properties for user code
Add environment variable expansion in data_dump_file and xopt_dump_file
Add tests for new property, legacy support, environment variable expansion
Not a fan of the rename + shim because of how many saves it affects. Would keeping dump_file + adding data_dump_file work?
In general, .data can contain whatever the evaluators return, including dicts - ok via YAML, but will get dumped as strings in CSV. Is that intended behavior? (probably yes)
Couple Claude-inspired-nits:
Silent behavior change in dump(). It previously raised ValueError when no file was specified; now it silently no-ops (and evaluate_data relies on that by calling it unconditionally).
adding xopt_dump_file to an old dumped config (which always contains dump_file: null) raises a ValidationError, precisely when the user follows the deprecation message's advice. The conflict check at xopt/base.py:267 should only fire when data["dump_file"] is not None.
Personally, I think having a .dump_file and .data_dump_file is confusing and I prefer the unambiguous names. With the before validator and properties, I think all user code / save files should keep working as-is. The intent would be to keep it that way for a long time with .xopt_dump_file being the official internal name in documentation to avoid having a .dump_file and .data_dump_file that seem to be the same thing.
In general, .data can contain whatever the evaluators return, including dicts
Yeah, I don't see a good way of getting around this, but this appears on the user side of whatever the evaluator function returns, so keep as-is.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This PR adds a new attribute
data_dump_filetoXoptwhich will automatically dumpXopt.datato a user specified CSV file while running. This avoids users having to parse the YAML file generated fromdump_fileand extracting their data. Full list of changes:data_dump_filefor a CSV file dumped during.run()dump_filetoxopt_dump_fileto avoid ambiguous name with new attribute.data_dump_fileandxopt_dump_file