-1

I have executed the Keras tuner, saw the output on the console, and then closed the console.

Now, I want to see the output again.

Where can I see it from, and how?

user366312
  • 16,949
  • 65
  • 235
  • 452
  • Have you check this https://stackoverflow.com/questions/38445982/how-to-log-keras-loss-output-to-a-file? – ferdy Nov 21 '21 at 03:21
  • 1
    @ferdy, i am not talking about `Keras`. I am talking about `KerasTuner`. `KerasTuner` stores its results in JSON files. – user366312 Nov 21 '21 at 03:29
  • Right. By the way who closed the console? Why not run again to see the output in console? – ferdy Nov 21 '21 at 05:30
  • 1
    @ferdy, Coz, it takes almost a week to generate output. I can't do that over and over again. – user366312 Nov 21 '21 at 23:51
  • Do you use tensorboard to view the tuning logs or you are only interested on console output? – ferdy Nov 22 '21 at 11:52
  • 1
    @ferdy, I am only interested in console o/p. Coz, I am using a remote SSH Linux terminal. – user366312 Nov 24 '21 at 00:22

2 Answers2

2

Log console output from the start

Typical command would be:

python mytuner.py | tee -a console.log

The -a will write in append mode. Without -a will overwrite the existing console.log file.

Check existing logs

If you can access the tuner search, check what is in the callback. Perhaps CSVLogger is defined there. Check the contents of the csv file. Probably not the complete log as in the console is in there.

tuner.search(
    train_features,
    train_labels,
    epochs=100,
    batch_size=BATCH_SIZE,
    validation_data=(val_features, val_labels),
    callbacks=[tf.keras.callbacks.CSVLogger('e:/ktuner/mylog.csv', separator=",", append=False)],
)

Check log via tensorboard

If you can access the tuner search, check the tensorboard callback.

tuner.search(
    train_features,
    train_labels,
    epochs=100,
    batch_size=BATCH_SIZE,
    validation_data=(val_features, val_labels),
    callbacks=[keras.callbacks.TensorBoard("e:/ktuner/logs")]
)

Install tensorboard then send the command:

tensorboard --logdir e:/ktuner/logs

In the tensorboard GUI there is an option to show download link. You can download csv or json file from different metric monitors. The logs here may not be the same as in the console logs.

enter image description here

ferdy
  • 4,396
  • 2
  • 4
  • 16
0

I would suggest to use the tensorboard callback. This because the CSV logger does not save all the trails, nor the best trail, but only the last trail.

If you would want the result of a search from the past, where there where no callbacks in place, as is probably the case here, you can open the trial.json from the files that are created during a search. This will provide a dict with all results of that trail.

BH.
  • 1
  • 1