class_docstr: Class to represent labels in a dataset.
  
  It stores the labels as a numpy array and maps them to integers if necessary.
  If a mapping is not necessary, e.g. for regression tasks, the mapping will be an empty dictionary.
  
  Parameters
  ----------
  data :
      A Hugging Face Dataset object.
  
  label_name : str
      Name of the label column in the dataset.
  
  map_to_int : bool
      Whether to map the labels to integers, e.g. [0, 1, ..., K-1] where K is the number of classes.
      If False, the labels are not mapped to integers, e.g. for regression tasks.
code: def __init__(
      self,
      *,
      data: Dataset,
      label_name: Optional[str] = None,
      map_to_int: bool = True,
  ) -> None:
      self._data = data
      self.label_name = label_name
      self.labels = labels_to_array([])
      self.label_map: Mapping[Union[str, int], Any] = {}
      if label_name is not None:
          self.labels, self.label_map = _extract_labels(
              data, label_name, map_to_int
          )
          self._validate_labels()
  
imports: import os
  from typing import Any, Callable, Dict, List, Mapping, Optional, Tuple, Union, cast, TYPE_CHECKING
  import numpy
  import pandas
  from datasets.arrow_dataset import Dataset
  from datasets import ClassLabel
  from cleanlab.internal.validation import labels_to_array
label_desc: Use image node_id 1 to create a new Label object  with example: obj = Label()