class_docstr: Enum for the different methods to compute label quality scores.
class_docstr_tok: ["Enum","for","the","different","methods","to","compute","label","quality","scores","."]
docstr: Constructs an instance of the ClassLabelScorer enum based on the given method name.
  
  Parameters
  ----------
  method:
      The name of the scoring method to use.
  
  Returns
  -------
  scorer:
      An instance of the ClassLabelScorer enum.
  
  Raises
  ------
  ValueError:
      If the given method name is not a valid method name.
      It must be one of the following: "self_confidence", "normalized_margin", or "confidence_weighted_entropy".
  
  Example
  -------
  >>> from cleanlab.internal.multilabel_scorer import ClassLabelScorer
  >>> ClassLabelScorer.from_str("self_confidence")
  <ClassLabelScorer.SELF_CONFIDENCE: get_self_confidence_for_each_label>
docstr_tok: ["Constructs","an","instance","of","the","ClassLabelScorer","enum","based","on","the","given","method","name",".","Parameters","--","--","--","--","--","method",":","The","name","of","the","scoring","method","to","use",".","Returns","--","--","--","-","scorer",":","An","instance","of","the","ClassLabelScorer","enum",".","Raises","--","--","--","ValueError",":","If","the","given","method","name","is","not","a","valid","method","name",".","It","must","be","one","of","the","following",":","``","self_confidence","''",",","``","normalized_margin","''",",","or","``","confidence_weighted_entropy","''",".","Example","--","--","--","-",">",">",">","from","cleanlab.internal.multilabel_scorer","import","ClassLabelScorer",">",">",">","ClassLabelScorer.from_str","(","``","self_confidence","''",")","<","ClassLabelScorer.SELF_CONFIDENCE",":","get_self_confidence_for_each_label",">"]
code: def from_str(cls, method: str) -> "ClassLabelScorer":
      """Constructs an instance of the ClassLabelScorer enum based on the given method name.
  
      Parameters
      ----------
      method:
          The name of the scoring method to use.
  
      Returns
      -------
      scorer:
          An instance of the ClassLabelScorer enum.
  
      Raises
      ------
      ValueError:
          If the given method name is not a valid method name.
          It must be one of the following: "self_confidence", "normalized_margin", or "confidence_weighted_entropy".
  
      Example
      -------
      >>> from cleanlab.internal.multilabel_scorer import ClassLabelScorer
      >>> ClassLabelScorer.from_str("self_confidence")
      <ClassLabelScorer.SELF_CONFIDENCE: get_self_confidence_for_each_label>
      """
      try:
          return cls[method.upper()]
      except KeyError:
          raise ValueError(f"Invalid method name: {method}")
  
imports: from enum import Enum
  from typing import Callable, Dict, Optional, Union
  import numpy
  from sklearn.model_selection import cross_val_predict
  from cleanlab.internal.multilabel_utils import _is_multilabel, stack_complement
  from cleanlab.internal.label_quality_utils import _subtract_confident_thresholds
  from cleanlab.internal.numerics import softmax
  from cleanlab.rank import get_self_confidence_for_each_label, get_normalized_margin_for_each_label, get_confidence_weighted_entropy_for_each_label
label_desc: Use image node_id 3 for calling the ClassLabelScorer obj's underlying member method code with example usage: obj.from_str(cls, method) and returns: cls