This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
Fix for python 3.7 & using TensorBoard Callback #3
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.
In python 3.7 there is no _field_types I suppose so it didn't work with optuna.
Using signature.params did the trick for me.
Using TensorBoard Callback with optkeras resulted in error:
Original exception was: Traceback (most recent call last): File "optimize.py", line 216, in ok.optimize(objective, n_trials=50) File "/home/user/virtualenvs/tf1-py37/lib/python3.7/site-packages/optkeras/optkeras.py", line 135, in optimize self.study.optimize(*args, **kwargs) File "/home/user/.local/lib/python3.7/site-packages/optuna/study.py", line 261, in optimize gc_after_trial) File "/home/user/.local/lib/python3.7/site-packages/optuna/study.py", line 443, in _optimize_sequential self._run_trial_and_callbacks(func, catch, callbacks, gc_after_trial) File "/home/user/.local/lib/python3.7/site-packages/optuna/study.py", line 520, in _run_trial_and_callbacks trial = self._run_trial(func, catch, gc_after_trial) File "/home/user/.local/lib/python3.7/site-packages/optuna/study.py", line 539, in _run_trial result = func(trial) File "/home/user/virtualenvs/tf1-py37/lib/python3.7/site-packages/optkeras/optkeras.py", line 131, in fun_tf return fun(trial) File "optimize.py", line 210, in objective class_weight=class_weights) File "/home/user/virtualenvs/tf1-py37/lib/python3.7/site-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "/home/user/virtualenvs/tf1-py37/lib/python3.7/site-packages/keras/engine/training.py", line 1658, in fit_generator initial_epoch=initial_epoch) File "/home/user/virtualenvs/tf1-py37/lib/python3.7/site-packages/keras/engine/training_generator.py", line 255, in fit_generator callbacks.on_epoch_end(epoch, epoch_logs) File "/home/user/virtualenvs/tf1-py37/lib/python3.7/site-packages/keras/callbacks.py", line 152, in on_epoch_end callback.on_epoch_end(epoch, logs) File "/home/user/virtualenvs/tf1-py37/lib/python3.7/site-packages/keras/callbacks.py", line 1259, in on_epoch_end self._write_logs(logs, index) File "/home/user/virtualenvs/tf1-py37/lib/python3.7/site-packages/keras/callbacks.py", line 1270, in _write_logs summary_value.simple_value = value TypeError: '2019-12-09 22:36:08.838879' has type str, but expected one of: int, long, float