class_docstr: A class representing routines called reactively at specific phases during trained.
  
  These can be used to log or visualize the training progress using any of the metric scores developed before.
  The values are stored at the end of each training epoch. The following metric scores are currently available:
  
      * :class:`~gensim.models.callbacks.CoherenceMetric`
      * :class:`~gensim.models.callbacks.PerplexityMetric`
      * :class:`~gensim.models.callbacks.DiffMetric`
      * :class:`~gensim.models.callbacks.ConvergenceMetric`
class_docstr_tok: ["A","class","representing","routines","called","reactively","at","specific","phases","during","trained",".","These","can","be","used","to","log","or","visualize","the","training","progress","using","any","of","the","metric","scores","developed","before",".","The","values","are","stored","at","the","end","of","each","training","epoch",".","The","following","metric","scores","are","currently","available",":","*",":","class",":","`","~gensim.models.callbacks.CoherenceMetric","`","*",":","class",":","`","~gensim.models.callbacks.PerplexityMetric","`","*",":","class",":","`","~gensim.models.callbacks.DiffMetric","`","*",":","class",":","`","~gensim.models.callbacks.ConvergenceMetric","`"]
docstr: Report the current epoch's metric value.
  
  Called at the end of each training iteration.
  
  Parameters
  ----------
  epoch : int
      The epoch that just ended.
  topics : list of list of str, optional
      List of tokenized topics. This is required for the coherence metric.
  
  Returns
  -------
  dict of (str, object)
      Mapping from metric names to their values. The type of each value depends on the metric type,
      for example :class:`~gensim.models.callbacks.DiffMetric` computes a matrix while
      :class:`~gensim.models.callbacks.ConvergenceMetric` computes a float.
docstr_tok: ["Report","the","current","epoch","'s","metric","value",".","Called","at","the","end","of","each","training","iteration",".","Parameters","--","--","--","--","--","epoch",":","int","The","epoch","that","just","ended",".","topics",":","list","of","list","of","str",",","optional","List","of","tokenized","topics",".","This","is","required","for","the","coherence","metric",".","Returns","--","--","--","-","dict","of","(","str",",","object",")","Mapping","from","metric","names","to","their","values",".","The","type","of","each","value","depends","on","the","metric","type",",","for","example",":","class",":","`","~gensim.models.callbacks.DiffMetric","`","computes","a","matrix","while",":","class",":","`","~gensim.models.callbacks.ConvergenceMetric","`","computes","a","float","."]
code: def on_epoch_end(self, epoch, topics=None):
      """Report the current epoch's metric value.
  
      Called at the end of each training iteration.
  
      Parameters
      ----------
      epoch : int
          The epoch that just ended.
      topics : list of list of str, optional
          List of tokenized topics. This is required for the coherence metric.
  
      Returns
      -------
      dict of (str, object)
          Mapping from metric names to their values. The type of each value depends on the metric type,
          for example :class:`~gensim.models.callbacks.DiffMetric` computes a matrix while
          :class:`~gensim.models.callbacks.ConvergenceMetric` computes a float.
  
      """
      # stores current epoch's metric values
      current_metrics = {}
  
      # plot all metrics in current epoch
      for i, metric in enumerate(self.metrics):
          label = str(metric)
          value = metric.get_value(
              topics=topics, model=self.model, other_model=self.previous
          )
  
          current_metrics[label] = value
  
          if metric.logger == "visdom":
              if epoch == 0:
                  if value.ndim > 0:
                      diff_mat = np.array([value])
                      viz_metric = self.viz.heatmap(
                          X=diff_mat.T,
                          env=metric.viz_env,
                          opts=dict(
                              xlabel="Epochs", ylabel=label, title=label
                          ),
                      )
                      # store current epoch's diff diagonal
                      self.diff_mat.put(diff_mat)
                      # saving initial plot window
                      self.windows.append(copy.deepcopy(viz_metric))
                  else:
                      viz_metric = self.viz.line(
                          Y=np.array([value]),
                          X=np.array([epoch]),
                          env=metric.viz_env,
                          opts=dict(
                              xlabel="Epochs", ylabel=label, title=label
                          ),
                      )
                      # saving initial plot window
                      self.windows.append(copy.deepcopy(viz_metric))
              else:
                  if value.ndim > 0:
                      # concatenate with previous epoch's diff diagonals
                      diff_mat = np.concatenate(
                          (self.diff_mat.get(), np.array([value]))
                      )
                      self.viz.heatmap(
                          X=diff_mat.T,
                          env=metric.viz_env,
                          win=self.windows[i],
                          opts=dict(
                              xlabel="Epochs", ylabel=label, title=label
                          ),
                      )
                      self.diff_mat.put(diff_mat)
                  else:
                      self.viz.line(
                          Y=np.array([value]),
                          X=np.array([epoch]),
                          env=metric.viz_env,
                          win=self.windows[i],
                          update="append",
                      )
  
          if metric.logger == "shell":
              statement = "".join(
                  (
                      "Epoch ",
                      str(epoch),
                      ": ",
                      label,
                      " estimate: ",
                      str(value),
                  )
              )
              self.log_type.info(statement)
  
      # check for any metric which need model state from previous epoch
      if any(
          isinstance(metric, (DiffMetric, ConvergenceMetric))
          for metric in self.metrics
      ):
          self.previous = copy.deepcopy(self.model)
  
      return current_metrics
  
imports: import gensim
  import logging
  import copy
  import sys
  import numpy
label_desc: Use image node_id 3 for calling the Callback obj's underlying member method code with example usage: obj.on_epoch_end(epoch, topics) and returns: current_metrics