class_docstr: Performs validation while training a KerasModel.
  
  This is a callback that can be passed to fit().  It periodically computes a
  set of metrics over a validation set, writes them to a file, and keeps track
  of the best score. In addition, it can save the best model parameters found
  so far to a directory on disk, updating them every time it finds a new best
  validation score.
  
  If Tensorboard logging is enabled on the KerasModel, the metrics are also
  logged to Tensorboard.  This only happens when validation coincides with a
  step on which the model writes to the log.  You should therefore make sure
  that this callback's reporting interval is an even fraction or multiple of
  the model's logging interval.
class_docstr_tok: ["Performs","validation","while","training","a","KerasModel",".","This","is","a","callback","that","can","be","passed","to","fit","(",")",".","It","periodically","computes","a","set","of","metrics","over","a","validation","set",",","writes","them","to","a","file",",","and","keeps","track","of","the","best","score",".","In","addition",",","it","can","save","the","best","model","parameters","found","so","far","to","a","directory","on","disk",",","updating","them","every","time","it","finds","a","new","best","validation","score",".","If","Tensorboard","logging","is","enabled","on","the","KerasModel",",","the","metrics","are","also","logged","to","Tensorboard",".","This","only","happens","when","validation","coincides","with","a","step","on","which","the","model","writes","to","the","log",".","You","should","therefore","make","sure","that","this","callback","'s","reporting","interval","is","an","even","fraction","or","multiple","of","the","model","'s","logging","interval","."]
docstr: This is invoked by the KerasModel after every step of fitting.
  
  Parameters
  ----------
  model: KerasModel
      the model that is being trained
  step: int
      the index of the training step that has just completed
docstr_tok: ["This","is","invoked","by","the","KerasModel","after","every","step","of","fitting",".","Parameters","--","--","--","--","--","model",":","KerasModel","the","model","that","is","being","trained","step",":","int","the","index","of","the","training","step","that","has","just","completed"]
code: def __call__(self, model, step):
      """This is invoked by the KerasModel after every step of fitting.
  
      Parameters
      ----------
      model: KerasModel
          the model that is being trained
      step: int
          the index of the training step that has just completed
      """
      if step % self.interval != 0:
          return
      scores = model.evaluate(
          self.dataset, self.metrics, self.transformers
      )
      message = "Step %d validation:" % step
      for key in scores:
          message += " %s=%g" % (key, scores[key])
      print(message, file=self.output_file)
      if model.tensorboard:
          for key in scores:
              model._log_scalar_to_tensorboard(
                  key, scores[key], model.get_global_step()
              )
      score = scores[self.metrics[self.save_metric].name]
      if not self.save_on_minimum:
          score = -score
      if self._best_score is None or score < self._best_score:
          self._best_score = score
          if self.save_dir is not None:
              model.save_checkpoint(model_dir=self.save_dir)
      if model.wandb_logger is not None:
          # Log data to Wandb
          data = {"eval/" + k: v for k, v in scores.items()}
          model.wandb_logger.log_data(
              data, step, dataset_id=id(self.dataset)
          )
  
imports: import sys
label_desc: Use image node_id 2 for calling the ValidationCallback obj's underlying member method code with example usage: obj.__call__(model, step) without return types