Skip to content

Instantly share code, notes, and snippets.

View sgodfrey66's full-sized avatar

Stephen Godfrey sgodfrey66

View GitHub Profile
history=model.fit(x=ds.train_ds_modeling,
y=None,
batch_size=None,
verbose=1,
validation_split=0.0,
epochs=epochs,
validation_data=ds.test_ds_modeling,
callbacks=callbacks)
# Create a callback for TensorBoard and put it in a list
callbacks=[tf.keras.callbacks.TensorBoard(log_dir=model_log,
histogram_freq=1,
write_graph=True,
write_images=False,
update_freq='epoch')]
# Create the TensorBoard writer for the confusion matrix writer
cm_file_writer=tf.summary.create_file_writer(logdir=cm_log)
# Define the confusion matrix logging function
def cm_logger(epoch, logs):
# Create a name for this image
i_name='Confusion Matrix: {}; {}'.format(model_name, ds.dataset_name)
# Create the per-epoch callback for the confusion matrix
cm_image=image_funcs.plot_to_image(metrics_funcs.generate_heatmap(
dataset=ds,
model=model).figure)