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

Method __init__

tensorflow/python/keras/callbacks.py:1177–1215  ·  view source on GitHub ↗
(self,
               monitor='val_loss',
               min_delta=0,
               patience=0,
               verbose=0,
               mode='auto',
               baseline=None,
               restore_best_weights=False)

Source from the content-addressed store, hash-verified

1175 """
1176
1177 def __init__(self,
1178 monitor='val_loss',
1179 min_delta=0,
1180 patience=0,
1181 verbose=0,
1182 mode='auto',
1183 baseline=None,
1184 restore_best_weights=False):
1185 super(EarlyStopping, self).__init__()
1186
1187 self.monitor = monitor
1188 self.patience = patience
1189 self.verbose = verbose
1190 self.baseline = baseline
1191 self.min_delta = abs(min_delta)
1192 self.wait = 0
1193 self.stopped_epoch = 0
1194 self.restore_best_weights = restore_best_weights
1195 self.best_weights = None
1196
1197 if mode not in ['auto', 'min', 'max']:
1198 logging.warning('EarlyStopping mode %s is unknown, '
1199 'fallback to auto mode.', mode)
1200 mode = 'auto'
1201
1202 if mode == 'min':
1203 self.monitor_op = np.less
1204 elif mode == 'max':
1205 self.monitor_op = np.greater
1206 else:
1207 if 'acc' in self.monitor:
1208 self.monitor_op = np.greater
1209 else:
1210 self.monitor_op = np.less
1211
1212 if self.monitor_op == np.greater:
1213 self.min_delta *= 1
1214 else:
1215 self.min_delta *= -1
1216
1217 def on_train_begin(self, logs=None):
1218 # Allow instances to be re-used

Callers

nothing calls this directly

Calls 2

absFunction · 0.70
__init__Method · 0.45

Tested by

no test coverage detected