2
$\begingroup$

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

$\endgroup$
1
0
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.