class_docstr: Tracks binary metrics, such as precision, recall, F1, EER, etc.
      
docstr: Compute statistics using a full set of scores.
  
  Full set of fields:
   - TP - True Positive
   - TN - True Negative
   - FP - False Positive
   - FN - False Negative
   - FAR - False Acceptance Rate
   - FRR - False Rejection Rate
   - DER - Detection Error Rate (EER if no threshold passed)
   - threshold - threshold (EER threshold if no threshold passed)
   - precision - Precision (positive predictive value)
   - recall - Recall (sensitivity)
   - F-score - Balance of precision and recall (equal if beta=1)
   - MCC - Matthews Correlation Coefficient
  
  Arguments
  ---------
  field : str
      A key for selecting a single statistic. If not provided,
      a dict with all statistics is returned.
  threshold : float
      If no threshold is provided, equal error rate is used.
  max_samples: float
      How many samples to keep for postive/negative scores.
      If no max_samples is provided, all scores are kept.
      Only effective when threshold is None.
  beta : float
      How much to weight precision vs recall in F-score. Default
      of 1. is equal weight, while higher values weight recall
      higher, and lower values weight precision higher.
  eps : float
      A small value to avoid dividing by zero.
docstr_tok: ["Compute","statistics","using","a","full","set","of","scores",".","Full","set","of","fields",":","-","TP","-","True","Positive","-","TN","-","True","Negative","-","FP","-","False","Positive","-","FN","-","False","Negative","-","FAR","-","False","Acceptance","Rate","-","FRR","-","False","Rejection","Rate","-","DER","-","Detection","Error","Rate","(","EER","if","no","threshold","passed",")","-","threshold","-","threshold","(","EER","threshold","if","no","threshold","passed",")","-","precision","-","Precision","(","positive","predictive","value",")","-","recall","-","Recall","(","sensitivity",")","-","F-score","-","Balance","of","precision","and","recall","(","equal","if","beta=1",")","-","MCC","-","Matthews","Correlation","Coefficient","Arguments","--","--","--","--","-","field",":","str","A","key","for","selecting","a","single","statistic",".","If","not","provided",",","a","dict","with","all","statistics","is","returned",".","threshold",":","float","If","no","threshold","is","provided",",","equal","error","rate","is","used",".","max_samples",":","float","How","many","samples","to","keep","for","postive\/negative","scores",".","If","no","max_samples","is","provided",",","all","scores","are","kept",".","Only","effective","when","threshold","is","None",".","beta",":","float","How","much","to","weight","precision","vs","recall","in","F-score",".","Default","of","1.","is","equal","weight",",","while","higher","values","weight","recall","higher",",","and","lower","values","weight","precision","higher",".","eps",":","float","A","small","value","to","avoid","dividing","by","zero","."]
code: def summarize(
      self,
      field=None,
      threshold=None,
      max_samples=None,
      beta=1,
      eps=1e-8,
  ):
      """Compute statistics using a full set of scores.
  
      Full set of fields:
       - TP - True Positive
       - TN - True Negative
       - FP - False Positive
       - FN - False Negative
       - FAR - False Acceptance Rate
       - FRR - False Rejection Rate
       - DER - Detection Error Rate (EER if no threshold passed)
       - threshold - threshold (EER threshold if no threshold passed)
       - precision - Precision (positive predictive value)
       - recall - Recall (sensitivity)
       - F-score - Balance of precision and recall (equal if beta=1)
       - MCC - Matthews Correlation Coefficient
  
      Arguments
      ---------
      field : str
          A key for selecting a single statistic. If not provided,
          a dict with all statistics is returned.
      threshold : float
          If no threshold is provided, equal error rate is used.
      max_samples: float
          How many samples to keep for postive/negative scores.
          If no max_samples is provided, all scores are kept.
          Only effective when threshold is None.
      beta : float
          How much to weight precision vs recall in F-score. Default
          of 1. is equal weight, while higher values weight recall
          higher, and lower values weight precision higher.
      eps : float
          A small value to avoid dividing by zero.
      """
  
      if isinstance(self.scores, list):
          self.scores = torch.stack(self.scores)
          self.labels = torch.stack(self.labels)
  
      if threshold is None:
          positive_scores = self.scores[
              (self.labels == self.positive_label).nonzero(
                  as_tuple=True
              )
          ]
          negative_scores = self.scores[
              (self.labels != self.positive_label).nonzero(
                  as_tuple=True
              )
          ]
          if max_samples is not None:
              if len(positive_scores) > max_samples:
                  positive_scores, _ = torch.sort(positive_scores)
                  positive_scores = positive_scores[
                      [
                          i
                          for i in range(
                              0,
                              len(positive_scores),
                              int(len(positive_scores) / max_samples),
                          )
                      ]
                  ]
              if len(negative_scores) > max_samples:
                  negative_scores, _ = torch.sort(negative_scores)
                  negative_scores = negative_scores[
                      [
                          i
                          for i in range(
                              0,
                              len(negative_scores),
                              int(len(negative_scores) / max_samples),
                          )
                      ]
                  ]
  
          eer, threshold = EER(positive_scores, negative_scores)
  
      pred = (self.scores > threshold).float()
      true = self.labels
  
      TP = self.summary["TP"] = float(pred.mul(true).sum())
      TN = self.summary["TN"] = float(
          (1.0 - pred).mul(1.0 - true).sum()
      )
      FP = self.summary["FP"] = float(pred.mul(1.0 - true).sum())
      FN = self.summary["FN"] = float((1.0 - pred).mul(true).sum())
  
      self.summary["FAR"] = FP / (FP + TN + eps)
      self.summary["FRR"] = FN / (TP + FN + eps)
      self.summary["DER"] = (FP + FN) / (TP + TN + eps)
      self.summary["threshold"] = threshold
  
      self.summary["precision"] = TP / (TP + FP + eps)
      self.summary["recall"] = TP / (TP + FN + eps)
      self.summary["F-score"] = (
          (1.0 + beta**2.0)
          * TP
          / ((1.0 + beta**2.0) * TP + beta**2.0 * FN + FP)
      )
  
      self.summary["MCC"] = (TP * TN - FP * FN) / (
          (TP + FP) * (TP + FN) * (TN + FP) * (TN + FN) + eps
      ) ** 0.5
  
      if field is not None:
          return self.summary[field]
      else:
          return self.summary
  
imports: import torch
  from joblib import Parallel, delayed
  from speechbrain.utils.data_utils import undo_padding
  from speechbrain.utils.edit_distance import wer_summary, wer_details_for_batch
  from speechbrain.dataio.dataio import merge_char, split_word, extract_concepts_values
  from speechbrain.dataio.wer import print_wer_summary, print_alignments
label_desc: Use image node_id 4 for calling the BinaryMetricStats obj's underlying member method code with example usage: obj.summarize(field, threshold, max_samples, beta, eps) and returns: self, self