Preview:
num_folds = 10
kfold = KFold(n_splits=num_folds, shuffle=True)
# K-fold Cross Validation model evaluation
fold_no = 1
histories = {'accuracy':[], 'loss':[], 'val_accuracy':[], 'val_loss':[]}

for train, test in kfold.split(X, label):
  print("---"*20)
  history = siamese.fit(
      [tf.gather(X[:,0], train),tf.gather(X[:,1], train)],
      tf.gather(label, train),
      validation_data=([tf.gather(X[:,0], test),tf.gather(X[:,1], test)], tf.gather(label, test)),
      batch_size=batch_size,
      epochs=epochs,
  )
  histories['accuracy'].append(history.history['accuracy'])
  histories['loss'].append(history.history['loss'])
  histories['val_accuracy'].append(history.history['val_accuracy'])
  histories['val_loss'].append(history.history['val_loss'])
with open('./trainHistoryDict', 'wb') as file_pi:
      pickle.dump(histories, file_pi)
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter