📜  如何选择正确的时代 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:53.631000             🧑  作者: Mango

代码示例1
#val_loss needs to be minimal
from keras import callbacks
earlystopping = callbacks.EarlyStopping(monitor ="val_loss", 
                                        mode ="min", patience = 5, 
                                        restore_best_weights = True)
  
history = model.fit(partial_images, partial_labels, batch_size = 128, 
                    epochs = 25, validation_data =(val_images, val_labels), 
                    callbacks =[earlystopping])