1

I am tuning a Neural Net with Keras Tuner

I am creating logs this way:

tuner = RandomSearch(
    build_model,
    objective='val_accuracy',
    max_trials=5,
    executions_per_trial=3,
    directory='my_dir',
    project_name='helloworld')

This gives me this directory of log files:

/my_dir/helloworld/
-trial_xxxxx
-trial_yyyy
-trial_zzzz
-oracle.json
-tuner0.json

I can get the summary by writing

tuner.result_summary()

or even get the best model using

tuner.get_best_models(num_models=1)[0]

But I also want to explore the runs more in details and see if there are any patterns. For that I want to use TensorBoard, but if I write:

%tensorboard --logdir="my_dir/helloworld"

I only get a empty TensorBoard. I guess the problem here is that Keras Tuner and TensorBoard write logs in different fileformat.

My question is stil have anyone been able to run hyperparameter optimalization in Keras Tuner and then watch the log files in TensorBoard afterwards?

bjornsing
  • 322
  • 6
  • 25
  • Does [this](https://stackoverflow.com/a/60885464/14290681) answer your question? –  Sep 24 '20 at 08:07

1 Answers1

0

Tensorboard needs seperate logging through callbacks:

before running tuner.search() add

tensorboard=TensorBoard(log_dir='tensorborad_log_dir')

and add the tensorboard callback to tuner.search()

tuner.search(X_train, y_train, callbacks=[tensorboard])

then you can run

%tensorboard --logdir='tensorborad_log_dir'
Konsta
  • 11
  • 1