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

[Enhancement] tuner.search_space_summary() should return string object instead implicitly of printing to stdout. #1033

Open
GhostDog98 opened this issue Dec 24, 2024 · 0 comments

Comments

@GhostDog98
Copy link

Is your feature request related to a problem? Please describe.
Currently, if i would like to get search_space_summary into a variable, instead of printing to stdout, i need to do the following hack:

old_stdout = sys.stdout # for later
sys.stdout = io.StringIO() # capture stdout
tuner.search_space_summary()  # Print summary of search space to stdout
captured_output = sys.stdout.getvalue() # get the saved value...
sys.stdout = old_stdout # restore old stdout

This seems overly complex, and it is unintuitive behaviour that calling search_space_summary implicitly prints.
Additionally, in my opinion, it breaks PEP20 rule 2; that Explicit is better than implicit.
Describe the solution you'd like
I propose that instead of:
image

We essentially have:
image

Describe alternatives you've considered
Rename the function to print_seach_space_summary() to make it explicit to the programmer that this prints directly to STDOUT.
This, however, would still leave no "clean" way to get the search space summary programatically.

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

No branches or pull requests

1 participant