Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Data Science Stack Exchange is a question and answer site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field. It only takes a minute to sign up.
When filepath="weights-improvement-{epoch:02d}-{val_acc:.2f}.hdf5" I get key error val_acc (I use tensorflow 1.14.0).
When filepath="weights.best.hdf5" and save_best_only=True, it checkpoints the very best model observed during training, however it failed to save the model because accuracy was not increasing, so does it mean I need to increase the epochs. Also why doesn't it consider the available accuracy scores and pick the maximum score as the best model and save.
$\begingroup$Can you elaborate on Q2 in particular what makes you think it didn't pick the best 'score'? Can you share some output/evidence?$\endgroup$
$\begingroup$I have added the output to my question, I used 50 epochs, at epoch 28, the val_accuracy has improved to 0.7441, but the model was not checkpointed. Even after finishing 50 epochs the model was not saved. But when I use save_best_only = False, then the model is checkpointed at every epochs.$\endgroup$
For Question 2, based on your output, I agree with @spb below, that you need to change want you monitor to monitor='val_accuracy' if this is the metric you want to use.
If you need to improve your model, there are plenty of existing answers that tackle approaches to try and improve an existing model.
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.