(event_path, smooth_window, log_details=False)
return best_acc, best_step
Returns the best accuracy and the step it occurs in in the given events.

  This searches the summaries written in a given event file, which may be only a
  subset of the total summaries of a run, since the summaries of a run are
  sometimes split into multiple event files.

  Args:
    event_path: A string. The path to an event file.
    smooth_window: An integer that defines the neighborhood to be used in
      smoothing before the argmax (use <=1 for no smoothing)
    log_details: A boolean. Whether to log details regarding skipped event paths
      in which locating the validation accuracy tag failed.
Returns the best accuracy and the step it occurs in in the given events.
Returns the best accuracy and the step it occurs in in the given events .
def extract_best_from_event_file(event_path, smooth_window, log_details=False):
  """Returns the best accuracy and the step it occurs in in the given events.

  This searches the summaries written in a given event file, which may be only a
  subset of the total summaries of a run, since the summaries of a run are
  sometimes split into multiple event files.

  Args:
    event_path: A string. The path to an event file.
    smooth_window: An integer that defines the neighborhood to be used in
      smoothing before the argmax (use <=1 for no smoothing)
    log_details: A boolean. Whether to log details regarding skipped event paths
      in which locating the validation accuracy tag failed.
  """
  steps, valid_accs = [], []
  try:
    for event in tf.train.summary_iterator(event_path):
      step = event.step
      for value in event.summary.value:
        if any(
            valid_tag in value.tag for valid_tag in VALIDATION_ACCURACY_TAGS):
          steps.append(step)
          valid_accs.append(value.simple_value)
  except tf.errors.DataLossError:
    if log_details:
      tf.logging.info(
          'Omitting events from event_path {} because '
          'tf.train.summary_iterator(event_path) failed.'.format(event_path))
    return 0, 0
  if not valid_accs:
    # Could happen if there is no DataLossError above but for some reason
    # there is no validation accuracy tag found in the summary values.
    tf.logging.info(
        'Did not find any validation accuracy tags ({}) in event_path {}'
        .format(' or '.join(VALIDATION_ACCURACY_TAGS), event_path))
    return 0, 0
  if smooth_window > 1:
    valid_accs = moving_average(valid_accs, smooth_window)
  argmax_ind = np.argmax(valid_accs)
  best_acc = valid_accs[argmax_ind]
  best_step = steps[argmax_ind]
  if log_details:
    tf.logging.info('Successfully read event_path {} with best_acc {}'.format(
        event_path, best_acc))
  return best_acc, best_step
def extract_best_from_event_file ( event_path , smooth_window , log_details = False ) : steps , valid_accs = [ ] , [ ] try : for event in tf . train . summary_iterator ( event_path ) : step = event . step for value in event . summary . value : if any ( valid_tag in value . tag for valid_tag in VALIDATION_ACCURACY_TAGS ) : steps . append ( step ) valid_accs . append ( value . simple_value ) except tf . errors . DataLossError : if log_details : tf . logging . info ( 'Omitting events from event_path {} because ' 'tf.train.summary_iterator(event_path) failed.' . format ( event_path ) ) return 0 , 0 if not valid_accs : # Could happen if there is no DataLossError above but for some reason # there is no validation accuracy tag found in the summary values. tf . logging . info ( 'Did not find any validation accuracy tags ({}) in event_path {}' . format ( ' or ' . join ( VALIDATION_ACCURACY_TAGS ) , event_path ) ) return 0 , 0 if smooth_window > 1 : valid_accs = moving_average ( valid_accs , smooth_window ) argmax_ind = np . argmax ( valid_accs ) best_acc = valid_accs [ argmax_ind ] best_step = steps [ argmax_ind ] if log_details : tf . logging . info ( 'Successfully read event_path {} with best_acc {}' . format ( event_path , best_acc ) ) return best_acc , best_step