class_docstr: Categorical Top-K accuracy. Assumes integer labels, with
  each item to be classified having a single correct class.
  Tie break enables equal distribution of scores among the
  classes with same maximum predicted scores.
code: def __init__(self, top_k=1, tie_break=False):
      if top_k > 1 and tie_break:
          raise ConfigurationError(
              "Tie break in Categorical Accuracy "
              "can be done only for maximum (top_k = 1)"
          )
      if top_k <= 0:
          raise ConfigurationError(
              "top_k passed to Categorical Accuracy must be > 0"
          )
      self._top_k = top_k
      self._tie_break = tie_break
      self.correct_count = 0.0
      self.total_count = 0.0
  
file_path: magnitude/pymagnitude/third_party/allennlp/training/metrics/categorical_accuracy.py
imports: from __future__ import division
  from __future__ import absolute_import
  import torch
  from allennlp.common.checks import ConfigurationError
  from allennlp.training.metrics.metric import Metric
label_desc: Use image node_id 1 to create a new CategoricalAccuracy object from inherited base classes: Metric with example: obj = CategoricalAccuracy(top_k, tie_break)