From aed7d28f49129fb379e53ba21047b40f16884ec1 Mon Sep 17 00:00:00 2001 From: sgabor1 <44530800+sgabor1@users.noreply.github.com> Date: Mon, 9 Dec 2019 22:47:36 +0100 Subject: [PATCH] Fix for python 3.7 & using TensorBoard Callback --- optkeras/optkeras.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/optkeras/optkeras.py b/optkeras/optkeras.py index d5a0b1d..4960649 100644 --- a/optkeras/optkeras.py +++ b/optkeras/optkeras.py @@ -5,6 +5,7 @@ import numpy as np from datetime import datetime from pathlib import Path +from inspect import signature import optuna @@ -302,8 +303,6 @@ def on_epoch_end(self, epoch, logs={}): self.datetime_epoch_end = self.get_datetime() # Add error and val_error to logs for use as an objective to minimize - logs['_Datetime_epoch_begin'] = self.datetime_epoch_begin - logs['_Datetime_epoch_end'] = self.datetime_epoch_end logs['_Trial_num'] = self.trial.number # Update the best logs @@ -364,7 +363,7 @@ def random_grid_search(self, func, n_trials, **kwargs): def get_trial_default(): - num_fields = optuna.structs.FrozenTrial._field_types.__len__() + num_fields = len(signature(optuna.structs.FrozenTrial).parameters) assert num_fields in (10, 11, 12) if num_fields == 12: # possible future version return optuna.structs.FrozenTrial(