Data Science Asked by Patrice Carbonneau on August 14, 2021
I’m really struggling to understand how the parameters of Keras early stopping callbacks play out, especially in the presence of a baseline. What I want is simply for the training to stop within 2 epochs of the validation accuracy hitting 95%. So I try:
(trainX, testX, trainY, testY) = train_test_split(Tensor, Labels1Hot, test_size=0.2)
when2stop = EarlyStopping(mode='max',monitor='val_accuracy',verbose=1,patience=2,baseline=0.95)
history = model.fit(trainX, trainY, epochs = 100, batch_size = 500, validation_data = (testX, testY), callbacks=when2stop)
This just stops after just 2 epochs, even if the val accuracy has in fact improved. But the val accuracy is way off 0.95. Is this a bug or am I mis-understanding the baseline and patience settings?
Using: Tensorflow 2.4
Comment above to SO post is spot on. A custom callback, as provided in that post, is the solution and the term 'baseline' is not meant to be interpreted as a threshold.
Answered by Patrice Carbonneau on August 14, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP