MCPcopy Create free account
hub / github.com/TPCD/DCCL / step

Method step

project_utils/general_utils.py:330–346  ·  view source on GitHub ↗
(self, metrics, epoch=None)

Source from the content-addressed store, hash-verified

328 self.num_bad_epochs = 0
329
330 def step(self, metrics, epoch=None):
331 # convert `metrics` to float, in case it's a zero-dim Tensor
332 current = float(metrics)
333 self.last_epoch = epoch
334
335 if self.is_better(current, self.best):
336 self.best = current
337 self.num_bad_epochs = 0
338 else:
339 self.num_bad_epochs += 1
340
341 if self.num_bad_epochs > self.patience:
342 print('Tracked metric has plateaud')
343 self._reset()
344 return True
345 else:
346 return False
347
348 def is_better(self, a, best):
349

Callers 1

general_utils.pyFile · 0.45

Calls 2

is_betterMethod · 0.95
_resetMethod · 0.95

Tested by

no test coverage detected