class_docstr: The label model by `Snorkel <https://github.com/snorkel-team/snorkel/>`__.
  
  .. note:: It is not suited for multi-label classification and does not support it!
  
  Args:
      weak_labels: A `WeakLabels` object containing the weak labels and records.
      verbose: Whether to show print statements
      device: What device to place the model on ('cpu' or 'cuda:0', for example).
          Passed on to the `torch.Tensor.to()` calls.
  
  Examples:
      >>> from argilla.labeling.text_classification import WeakLabels
      >>> weak_labels = WeakLabels(dataset="my_dataset")
      >>> label_model = Snorkel(weak_labels)
      >>> label_model.fit()
      >>> records = label_model.predict()
class_docstr_tok: ["The","label","model","by","`","Snorkel","<","https",":","\/\/github.com\/snorkel-team\/snorkel\/",">","`","__",".","..","note",":",":","It","is","not","suited","for","multi-label","classification","and","does","not","support","it","!","Args",":","weak_labels",":","A","`","WeakLabels","`","object","containing","the","weak","labels","and","records",".","verbose",":","Whether","to","show","print","statements","device",":","What","device","to","place","the","model","on","(","'cpu","'","or","'cuda:0","'",",","for","example",")",".","Passed","on","to","the","`","torch.Tensor.to","(",")","`","calls",".","Examples",":",">",">",">","from","argilla.labeling.text_classification","import","WeakLabels",">",">",">","weak_labels","=","WeakLabels","(","dataset=","''","my_dataset","''",")",">",">",">","label_model","=","Snorkel","(","weak_labels",")",">",">",">","label_model.fit","(",")",">",">",">","records","=","label_model.predict","(",")"]
docstr: Helper function to copy and remap the weak label matrix or annotation array to be compatible with snorkel.
  
  Snorkel expects the abstain id to be -1 and the rest of the labels to be sequential.
  
  Args:
      matrix_or_array: The original weak label matrix or annotation array
  
  Returns:
      A copy of the weak label matrix, remapped to match snorkel's requirements.
docstr_tok: ["Helper","function","to","copy","and","remap","the","weak","label","matrix","or","annotation","array","to","be","compatible","with","snorkel",".","Snorkel","expects","the","abstain","id","to","be","-1","and","the","rest","of","the","labels","to","be","sequential",".","Args",":","matrix_or_array",":","The","original","weak","label","matrix","or","annotation","array","Returns",":","A","copy","of","the","weak","label","matrix",",","remapped","to","match","snorkel","'s","requirements","."]
code: def _copy_and_remap(self, matrix_or_array: np.ndarray):
      """Helper function to copy and remap the weak label matrix or annotation array to be compatible with snorkel.
  
      Snorkel expects the abstain id to be -1 and the rest of the labels to be sequential.
  
      Args:
          matrix_or_array: The original weak label matrix or annotation array
  
      Returns:
          A copy of the weak label matrix, remapped to match snorkel's requirements.
      """
      matrix_or_array = matrix_or_array.copy()
  
      # save masks for swapping
      label_masks = {}
  
      # compute masks
      for idx in self._weaklabelsInt2snorkelInt:
          label_masks[idx] = matrix_or_array == idx
  
      # swap integers
      for idx in self._weaklabelsInt2snorkelInt:
          matrix_or_array[
              label_masks[idx]
          ] = self._weaklabelsInt2snorkelInt[idx]
  
      return matrix_or_array
  
imports: import hashlib
  import logging
  from enum import Enum
  from typing import Dict, List, Tuple, Union
  import numpy
  from argilla import DatasetForTextClassification, TextClassificationRecord
  from argilla.labeling.text_classification.weak_labels import WeakLabels, WeakMultiLabels
  from argilla.utils.dependency import requires_dependencies
label_desc: Use image node_id 3 for calling the Snorkel obj's underlying member method code with example usage: obj._copy_and_remap(matrix_or_array) and returns: matrix_or_array