class_docstr: Abstract base class used to build new callbacks.
  
  The `logs` dictionary that callback methods
  take as argument will contain keys for quantities relevant to
  the current batch or epoch.
  
  Currently, the `.fit()` method of the `Model` class
  will include the following quantities in the `logs` that
  it passes to its callbacks:
  
  ```python
  on_epoch_end: logs include `acc` and `loss`, and
      optionally include `val_loss`
      (if validation is enabled in `fit`), and `val_acc`
      (if validation and accuracy monitoring are enabled).
  on_train_batch_begin: logs include `size`,
      the number of samples in the current batch.
  on_train_batch_end: logs include `loss`, and optionally `acc`
      (if accuracy monitoring is enabled).
  ```
  
  Attributes:
      params (dict):  Training parameters
          (eg. verbosity, batch size, number of epochs...).
      model (elegy.model.Model): Reference of the model being trained.
class_docstr_tok: ["Abstract","base","class","used","to","build","new","callbacks",".","The","`","logs","`","dictionary","that","callback","methods","take","as","argument","will","contain","keys","for","quantities","relevant","to","the","current","batch","or","epoch",".","Currently",",","the","`",".fit","(",")","`","method","of","the","`","Model","`","class","will","include","the","following","quantities","in","the","`","logs","`","that","it","passes","to","its","callbacks",":","``","`","python","on_epoch_end",":","logs","include","`","acc","`","and","`","loss","`",",","and","optionally","include","`","val_loss","`","(","if","validation","is","enabled","in","`","fit","`",")",",","and","`","val_acc","`","(","if","validation","and","accuracy","monitoring","are","enabled",")",".","on_train_batch_begin",":","logs","include","`","size","`",",","the","number","of","samples","in","the","current","batch",".","on_train_batch_end",":","logs","include","`","loss","`",",","and","optionally","`","acc","`","(","if","accuracy","monitoring","is","enabled",")",".","``","`","Attributes",":","params","(","dict",")",":","Training","parameters","(","eg",".","verbosity",",","batch","size",",","number","of","epochs","...",")",".","model","(","elegy.model.Model",")",":","Reference","of","the","model","being","trained","."]
docstr: Called at the def on_epoch_end(self, epoch, logs=None):
  current = self.get_monitor_value(logs)
  if current is None:
      return
  if self.monitor_op(current - self.min_delta, self.best):
      self.best = current
      self.wait = 0
      if self.restore_best_weights:
          # This will also save optimizer state
          self.best_state = self.model.full_state
  else:
      self.wait += 1
      if self.wait >= self.patience:
          self.stopped_epoch = epoch
          self.model.stop_training = True
          if self.restore_best_weights:
              if self.verbose > 0:
                  print("Restoring model weights from the end of the best epoch.")
              self.model.full_state = self.best_statestart of an epoch.
  
  Subclasses should override for any actions to run. This function should only
  be called during TRAIN mode.
  
  Arguments:
      epoch: integer, index of epoch.
      logs: dict. Currently no data is passed to this argument for this method but
          that may change in the future.
docstr_tok: ["Called","at","the","def","on_epoch_end","(","self",",","epoch",",","logs=None",")",":","current","=","self.get_monitor_value","(","logs",")","if","current","is","None",":","return","if","self.monitor_op","(","current","-","self.min_delta",",","self.best",")",":","self.best","=","current","self.wait","=","0","if","self.restore_best_weights",":","#","This","will","also","save","optimizer","state","self.best_state","=","self.model.full_state","else",":","self.wait","+=","1","if","self.wait",">","=","self.patience",":","self.stopped_epoch","=","epoch","self.model.stop_training","=","True","if","self.restore_best_weights",":","if","self.verbose",">","0",":","print","(","``","Restoring","model","weights","from","the","end","of","the","best","epoch",".","''",")","self.model.full_state","=","self.best_statestart","of","an","epoch",".","Subclasses","should","override","for","any","actions","to","run",".","This","function","should","only","be","called","during","TRAIN","mode",".","Arguments",":","epoch",":","integer",",","index","of","epoch",".","logs",":","dict",".","Currently","no","data","is","passed","to","this","argument","for","this","method","but","that","may","change","in","the","future","."]
code: def on_epoch_begin(
      self,
      epoch: int,
      logs: tp.Optional[tp.Dict[str, np.ndarray]] = None,
  ):
      """Called at the def on_epoch_end(self, epoch, logs=None):
      current = self.get_monitor_value(logs)
      if current is None:
          return
      if self.monitor_op(current - self.min_delta, self.best):
          self.best = current
          self.wait = 0
          if self.restore_best_weights:
              # This will also save optimizer state
              self.best_state = self.model.full_state
      else:
          self.wait += 1
          if self.wait >= self.patience:
              self.stopped_epoch = epoch
              self.model.stop_training = True
              if self.restore_best_weights:
                  if self.verbose > 0:
                      print("Restoring model weights from the end of the best epoch.")
                  self.model.full_state = self.best_statestart of an epoch.
  
      Subclasses should override for any actions to run. This function should only
      be called during TRAIN mode.
  
      Arguments:
          epoch: integer, index of epoch.
          logs: dict. Currently no data is passed to this argument for this method but
              that may change in the future.
      """
      pass
  
imports: import typing
  import numpy
label_desc: Use image node_id 4 for calling the Callback obj's underlying member method code with example usage: obj.on_epoch_begin(epoch, logs) without return types