(self, high)
return cur_step and last_is_best
Is the current step the best (highest if high, else lowest).
Is the current step the best (highest if high, else lowest).
Is the current step the best ( highest if high else lowest ) .
def _current_step_is_best(self, high):
    """Is the current step the best (highest if high, else lowest)."""
    metric = self._checkpoint_highest if high else self._checkpoint_lowest
    if metric is None:
      return False
    # History is a list of pairs (step, value).
    history = self._history.get('eval', 'metrics/' + metric)
    sequence = [float(i[1]) for i in history]  # Just the values.
    best = max(sequence) if high else min(sequence)  # Best value.
    last_is_best = float(history[-1][1]) == best  # Is last the best?
    cur_step = history[-1][0] == self._step  # Is last the current step?
    return cur_step and last_is_best
def _current_step_is_best ( self , high ) : metric = self . _checkpoint_highest if high else self . _checkpoint_lowest if metric is None : return False # History is a list of pairs (step, value). history = self . _history . get ( 'eval' , 'metrics/' + metric ) sequence = [ float ( i [ 1 ] ) for i in history ] # Just the values. best = max ( sequence ) if high else min ( sequence ) # Best value. last_is_best = float ( history [ - 1 ] [ 1 ] ) == best # Is last the best? cur_step = history [ - 1 ] [ 0 ] == self . _step # Is last the current step? return cur_step and last_is_best