class_docstr: A `LabelField` is a categorical label of some kind, where the labels are either strings of
  text or 0-indexed integers (if you wish to skip indexing by passing skip_indexing=True).
  If the labels need indexing, we will use a :class:`Vocabulary` to convert the string labels
  into integers.
  
  This field will get converted into an integer index representing the class label.
  
  # Parameters
  
  label : `Union[str, int]`
  label_namespace : `str`, optional (default=`"labels"`)
      The namespace to use for converting label strings into integers.  We map label strings to
      integers for you (e.g., "entailment" and "contradiction" get converted to 0, 1, ...),
      and this namespace tells the `Vocabulary` object which mapping from strings to integers
      to use (so "entailment" as a label doesn't get the same integer id as "entailment" as a
      word).  If you have multiple different label fields in your data, you should make sure you
      use different namespaces for each one, always using the suffix "labels" (e.g.,
      "passage_labels" and "question_labels").
  skip_indexing : `bool`, optional (default=`False`)
      If your labels are 0-indexed integers, you can pass in this flag, and we'll skip the indexing
      step.  If this is `False` and your labels are not strings, this throws a `ConfigurationError`.
class_docstr_tok: ["A","`","LabelField","`","is","a","categorical","label","of","some","kind",",","where","the","labels","are","either","strings","of","text","or","0-indexed","integers","(","if","you","wish","to","skip","indexing","by","passing","skip_indexing=True",")",".","If","the","labels","need","indexing",",","we","will","use","a",":","class",":","`","Vocabulary","`","to","convert","the","string","labels","into","integers",".","This","field","will","get","converted","into","an","integer","index","representing","the","class","label",".","#","Parameters","label",":","`","Union","[","str",",","int","]","`","label_namespace",":","`","str","`",",","optional","(","default=","`","``","labels","''","`",")","The","namespace","to","use","for","converting","label","strings","into","integers",".","We","map","label","strings","to","integers","for","you","(","e.g.",",","``","entailment","''","and","``","contradiction","''","get","converted","to","0",",","1",",","...",")",",","and","this","namespace","tells","the","`","Vocabulary","`","object","which","mapping","from","strings","to","integers","to","use","(","so","``","entailment","''","as","a","label","does","n't","get","the","same","integer","id","as","``","entailment","''","as","a","word",")",".","If","you","have","multiple","different","label","fields","in","your","data",",","you","should","make","sure","you","use","different","namespaces","for","each","one",",","always","using","the","suffix","``","labels","''","(","e.g.",",","``","passage_labels","''","and","``","question_labels","''",")",".","skip_indexing",":","`","bool","`",",","optional","(","default=","`","False","`",")","If","your","labels","are","0-indexed","integers",",","you","can","pass","in","this","flag",",","and","we","'ll","skip","the","indexing","step",".","If","this","is","`","False","`","and","your","labels","are","not","strings",",","this","throws","a","`","ConfigurationError","`","."]
code: def __init__(
      self,
      label: Union[str, int],
      label_namespace: str = "labels",
      skip_indexing: bool = False,
  ) -> None:
      self.label = label
      self._label_namespace = label_namespace
      self._label_id = None
      self._maybe_warn_for_namespace(label_namespace)
      self._skip_indexing = skip_indexing
  
      if skip_indexing:
          if not isinstance(label, int):
              raise ConfigurationError(
                  "In order to skip indexing, your labels must be integers. "
                  "Found label = {}".format(label)
              )
          self._label_id = label
      elif not isinstance(label, str):
          raise ConfigurationError(
              "LabelFields must be passed a string label if skip_indexing=False. "
              "Found label: {} with type: {}.".format(
                  label, type(label)
              )
          )
  
file_path: allennlp/allennlp/data/fields/label_field.py
imports: from typing import Dict, Union, Set
  import logging
  import torch
  from allennlp.data.fields.field import Field
  from allennlp.data.vocabulary import Vocabulary
  from allennlp.common.checks import ConfigurationError
label_desc: Use image node_id 1 to create a new LabelField object from inherited base classes: Field with example: obj = LabelField(label, label_namespace, skip_indexing)