class_docstr: Base class for hooks based on summary metrics.
  
  Subclasses should override _process_metrics.
  
  If _process_metrics returns True, calls run_context.request_stop().
  
  This can be used to something like "Stop after the loss has stopped decreasing
  for 5000 steps.
docstr: Construct MetricsBasedHook.
  
  Args:
    events_dir: str, top-level directory containing events files.
    subdirs: list<str>, subdirectories of events_dir that also contain
      events files. Use "" to specify the top-level directory. Defaults to
      [""].
    tags: list<str>, names of metrics to collect. Default will collect all
      metrics.
    every_n_steps: int, collect metrics every n steps.
docstr_tok: ["Construct","MetricsBasedHook",".","Args",":","events_dir",":","str",",","top-level","directory","containing","events","files",".","subdirs",":","list","<","str",">",",","subdirectories","of","events_dir","that","also","contain","events","files",".","Use","``","''","to","specify","the","top-level","directory",".","Defaults","to","[","``","''","]",".","tags",":","list","<","str",">",",","names","of","metrics","to","collect",".","Default","will","collect","all","metrics",".","every_n_steps",":","int",",","collect","metrics","every","n","steps","."]
code: def __init__(
      self, events_dir, subdirs=None, tags=None, every_n_steps=1000
  ):
      """Construct MetricsBasedHook.
  
      Args:
        events_dir: str, top-level directory containing events files.
        subdirs: list<str>, subdirectories of events_dir that also contain
          events files. Use "" to specify the top-level directory. Defaults to
          [""].
        tags: list<str>, names of metrics to collect. Default will collect all
          metrics.
        every_n_steps: int, collect metrics every n steps.
      """
      self._events_dir = events_dir
      self._subdirs = subdirs or [""]
      self._tags = tags
      self._every_n_steps = every_n_steps
      self._start_step = None
      self._event_multiplexer = self._init_multiplexer()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import tensorflow.compat.v1
  from tensorboard.backend.event_processing import event_accumulator
  from tensorboard.backend.event_processing import event_multiplexer
label_desc: Use image node_id 1 to create a new MetricsBasedHook object from inherited base classes: tf.train with example: obj = MetricsBasedHook(events_dir, subdirs, tags, every_n_steps)