MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / on_epoch_end

Method on_epoch_end

tensorflow/python/keras/callbacks.py:1226–1243  ·  view source on GitHub ↗
(self, epoch, logs=None)

Source from the content-addressed store, hash-verified

1224 self.best = np.Inf if self.monitor_op == np.less else -np.Inf
1225
1226 def on_epoch_end(self, epoch, logs=None):
1227 current = self.get_monitor_value(logs)
1228 if current is None:
1229 return
1230 if self.monitor_op(current - self.min_delta, self.best):
1231 self.best = current
1232 self.wait = 0
1233 if self.restore_best_weights:
1234 self.best_weights = self.model.get_weights()
1235 else:
1236 self.wait += 1
1237 if self.wait >= self.patience:
1238 self.stopped_epoch = epoch
1239 self.model.stop_training = True
1240 if self.restore_best_weights:
1241 if self.verbose > 0:
1242 print('Restoring model weights from the end of the best epoch.')
1243 self.model.set_weights(self.best_weights)
1244
1245 def on_train_end(self, logs=None):
1246 if self.stopped_epoch > 0 and self.verbose > 0:

Calls 3

get_monitor_valueMethod · 0.95
get_weightsMethod · 0.45
set_weightsMethod · 0.45