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

Make col_width customizable in Display class #1025

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions keras_tuner/engine/oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ def wrapped_func(*args, **kwargs):

# TODO: Add more extensive display.
class Display(stateful.Stateful):
def __init__(self, oracle, verbose=1):
def __init__(self, oracle, verbose=1, col_width=18):
self.verbose = verbose
self.oracle = oracle
self.col_width = 18
self.col_width = col_width

# Start time for the overall search
self.search_start = None
Expand Down Expand Up @@ -384,6 +384,14 @@ def verbose(self, value):
value = 1
self._display.verbose = value

@property
def col_width(self):
return self._display.col_width

@col_width.setter
def col_width(self, value):
self._display.col_width = value

def _populate_space(self, trial_id):
warnings.warn(
"The `_populate_space` method is deprecated, "
Expand Down
6 changes: 6 additions & 0 deletions keras_tuner/engine/oracle_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,3 +450,9 @@ def test_display_format_duration_large_d():
oracle.verbose = "auto"
assert oracle_module.Display(oracle).format_duration(d) == "7d 00h 00m 00s"
assert oracle.verbose == 1


def test_display_col_width() -> None:
oracle = gridsearch.GridSearchOracle()
oracle.col_width = 10
assert oracle_module.Display(oracle).col_width == 10