class_docstr: This evaluator can be used with the CrossEncoder class. Given sentence pairs and binary labels (0 and 1),
  it compute the average precision and the best possible f1 score
code: def __init__(
      self,
      sentence_pairs: List[List[str]],
      labels: List[int],
      name: str = "",
      show_progress_bar: bool = False,
      write_csv: bool = True,
  ):
      assert len(sentence_pairs) == len(labels)
      for label in labels:
          assert label == 0 or label == 1
  
      self.sentence_pairs = sentence_pairs
      self.labels = np.asarray(labels)
      self.name = name
  
      if show_progress_bar is None:
          show_progress_bar = (
              logger.getEffectiveLevel() == logging.INFO
              or logger.getEffectiveLevel() == logging.DEBUG
          )
      self.show_progress_bar = show_progress_bar
  
      self.csv_file = (
          "CEBinaryClassificationEvaluator"
          + ("_" + name if name else "")
          + "_results.csv"
      )
      self.csv_headers = [
          "epoch",
          "steps",
          "Accuracy",
          "Accuracy_Threshold",
          "F1",
          "F1_Threshold",
          "Precision",
          "Recall",
          "Average_Precision",
      ]
      self.write_csv = write_csv
  
file_path: sentence-transformers/sentence_transformers/cross_encoder/evaluation/CEBinaryClassificationEvaluator.py
imports: import logging
  from sklearn.metrics import average_precision_score
  from typing import List
  import numpy
  import os
  import csv
  from ...None import InputExample
  from ...evaluation import BinaryClassificationEvaluator
label_desc: Use image node_id 1 to create a new CEBinaryClassificationEvaluator object  with example: obj = CEBinaryClassificationEvaluator(sentence_pairs, labels, name, show_progress_bar, write_csv)