docstr: A metric reporter specific for computing TopK accuracy for a multi-class task.
  
  Args:
      label_names: Indexed label names.
      channels: Channel defines how to format/report the result of a PyText job to a stream.
      model_select_metric: Metric to use when selecting best model.
      target_label: n/a
      text_column_names: See ClassificationMetricReporter.
      additional_column_names: See ClassificationMetricReporter.
      recall_at_precision_thresholds: Index values to track recall at.
      is_memory_efficient: Whether to conserve memory or not.  Excludes scores if true.
      topk: The number of candidates to be chosen from the multi-class list.
code: def __init__(
      self,
      label_names: List[str],
      channels: List[Channel],
      model_select_metric: ComparableClassificationMetric = (
          ComparableClassificationMetric.ACCURACY
      ),
      target_label: Optional[str] = None,
      text_column_names: List[str] = Config.text_column_names,
      additional_column_names: List[
          str
      ] = Config.additional_column_names,
      recall_at_precision_thresholds: List[float] = (
          Config.recall_at_precision_thresholds
      ),
      is_memory_efficient: bool = Config.is_memory_efficient,
      topk: int = Config.topk,
  ) -> None:
      """
      A metric reporter specific for computing TopK accuracy for a multi-class task.
  
      Args:
          label_names: Indexed label names.
          channels: Channel defines how to format/report the result of a PyText job to a stream.
          model_select_metric: Metric to use when selecting best model.
          target_label: n/a
          text_column_names: See ClassificationMetricReporter.
          additional_column_names: See ClassificationMetricReporter.
          recall_at_precision_thresholds: Index values to track recall at.
          is_memory_efficient: Whether to conserve memory or not.  Excludes scores if true.
          topk: The number of candidates to be chosen from the multi-class list.
  
      """
      super().__init__(
          label_names,
          channels,
          model_select_metric,
          target_label,
          text_column_names,
          additional_column_names,
          recall_at_precision_thresholds,
          is_memory_efficient,
      )
      self.topk = topk
  
imports: from enum import Enum
  from itertools import tee, zip_longest
  from typing import Generator, List, Optional, Sequence
  import torch
  from pytext.common.constants import Stage
  from pytext.data import CommonMetadata
  from pytext.metrics import ClassificationMetrics, compute_classification_metrics, compute_multi_label_classification_metrics, LabelListPrediction, LabelPrediction, LabelTopKPrediction, RECALL_AT_PRECISION_THRESHOLDS, safe_division
  from pytext.metrics.intent_slot_metrics import PerLabelConfusions
  from .channel import Channel, ConsoleChannel, FileChannel
  from .metric_reporter import MetricReporter
label_desc: Use image node_id 1 to create a new TopKClassificationMetricReporter object from inherited base classes: ClassificationMetricReporter with example: obj = TopKClassificationMetricReporter(label_names, channels, model_select_metric, target_label, text_column_names, additional_column_names, recall_at_precision_thresholds, is_memory_efficient, topk)