Skip to content

Commit

Permalink
refactor: explicit question mark.
Browse files Browse the repository at this point in the history
  • Loading branch information
mah neh committed Oct 3, 2024
1 parent 54eef73 commit a52435d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions keras_tuner/engine/oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,25 +867,25 @@ def on_trial_end(self, trial: Trial) -> None:
)
print(f"Total elapsed time: {time_elapsed_str}")

def show_hyperparameter_table(self, trial: Trial) -> None:
def show_hyperparameter_table(self, current_trial: Trial) -> None:
"""Summary table with parameters and best values."""
template = f"{{0:{self.col_width}}}|{{1:{self.col_width}}}|{{2}}"
best_trials = self.oracle.get_best_trials()
best_trial = best_trials[0] if len(best_trials) > 0 else None
if trial.hyperparameters.values:
if current_trial.hyperparameters:
print(
template.format("Value", "Best Value So Far", "Hyperparameter")
)
for hp, value in trial.hyperparameters.values.items():
for hp, value in current_trial.hyperparameters.values.items():
best_value = (
best_trial.hyperparameters.values.get(hp)
if best_trial
else "?"
if best_trial and best_trial.hyperparameters
else None
)
print(
template.format(
self.format_value(value),
self.format_value(best_value),
self.format_value(best_value or "?"),
hp,
)
)
Expand Down

0 comments on commit a52435d

Please sign in to comment.