class_docstr: Evaluate a model based on the similarity of the embeddings by calculating the accuracy of identifying similar and
  dissimilar sentences.
  The metrics are the cosine similarity as well as euclidean and Manhattan distance
  The returned score is the accuracy with a specified metric.
  
  The results are written in a CSV. If a CSV already exists, then values are appended.
  
  The labels need to be 0 for dissimilar pairs and 1 for similar pairs.
  
  :param sentences1: The first column of sentences
  :param sentences2: The second column of sentences
  :param labels: labels[i] is the label for the pair (sentences1[i], sentences2[i]). Must be 0 or 1
  :param name: Name for the output
  :param batch_size: Batch size used to compute embeddings
  :param show_progress_bar: If true, prints a progress bar
  :param write_csv: Write results to a CSV file
class_docstr_tok: ["Evaluate","a","model","based","on","the","similarity","of","the","embeddings","by","calculating","the","accuracy","of","identifying","similar","and","dissimilar","sentences",".","The","metrics","are","the","cosine","similarity","as","well","as","euclidean","and","Manhattan","distance","The","returned","score","is","the","accuracy","with","a","specified","metric",".","The","results","are","written","in","a","CSV",".","If","a","CSV","already","exists",",","then","values","are","appended",".","The","labels","need","to","be","0","for","dissimilar","pairs","and","1","for","similar","pairs",".",":","param","sentences1",":","The","first","column","of","sentences",":","param","sentences2",":","The","second","column","of","sentences",":","param","labels",":","labels","[","i","]","is","the","label","for","the","pair","(","sentences1","[","i","]",",","sentences2","[","i","]",")",".","Must","be","0","or","1",":","param","name",":","Name","for","the","output",":","param","batch_size",":","Batch","size","used","to","compute","embeddings",":","param","show_progress_bar",":","If","true",",","prints","a","progress","bar",":","param","write_csv",":","Write","results","to","a","CSV","file"]
code: def compute_metrices(self, model):
      sentences = list(set(self.sentences1 + self.sentences2))
      embeddings = model.encode(
          sentences,
          batch_size=self.batch_size,
          show_progress_bar=self.show_progress_bar,
          convert_to_numpy=True,
      )
      emb_dict = {sent: emb for sent, emb in zip(sentences, embeddings)}
      embeddings1 = [emb_dict[sent] for sent in self.sentences1]
      embeddings2 = [emb_dict[sent] for sent in self.sentences2]
  
      cosine_scores = 1 - paired_cosine_distances(
          embeddings1, embeddings2
      )
      manhattan_distances = paired_manhattan_distances(
          embeddings1, embeddings2
      )
      euclidean_distances = paired_euclidean_distances(
          embeddings1, embeddings2
      )
  
      embeddings1_np = np.asarray(embeddings1)
      embeddings2_np = np.asarray(embeddings2)
      dot_scores = [
          np.dot(embeddings1_np[i], embeddings2_np[i])
          for i in range(len(embeddings1_np))
      ]
  
      labels = np.asarray(self.labels)
      output_scores = {}
      for short_name, name, scores, reverse in [
          ["cossim", "Cosine-Similarity", cosine_scores, True],
          [
              "manhattan",
              "Manhattan-Distance",
              manhattan_distances,
              False,
          ],
          [
              "euclidean",
              "Euclidean-Distance",
              euclidean_distances,
              False,
          ],
          ["dot", "Dot-Product", dot_scores, True],
      ]:
          acc, acc_threshold = self.find_best_acc_and_threshold(
              scores, labels, reverse
          )
          (
              f1,
              precision,
              recall,
              f1_threshold,
          ) = self.find_best_f1_and_threshold(scores, labels, reverse)
          ap = average_precision_score(
              labels, scores * (1 if reverse else -1)
          )
  
          logger.info(
              "Accuracy with {}:           {:.2f}\t(Threshold: {:.4f})".format(
                  name, acc * 100, acc_threshold
              )
          )
          logger.info(
              "F1 with {}:                 {:.2f}\t(Threshold: {:.4f})".format(
                  name, f1 * 100, f1_threshold
              )
          )
          logger.info(
              "Precision with {}:          {:.2f}".format(
                  name, precision * 100
              )
          )
          logger.info(
              "Recall with {}:             {:.2f}".format(
                  name, recall * 100
              )
          )
          logger.info(
              "Average Precision with {}:  {:.2f}\n".format(
                  name, ap * 100
              )
          )
  
          output_scores[short_name] = {
              "accuracy": acc,
              "accuracy_threshold": acc_threshold,
              "f1": f1,
              "f1_threshold": f1_threshold,
              "precision": precision,
              "recall": recall,
              "ap": ap,
          }
  
      return output_scores
  
file_path: sentence-transformers/sentence_transformers/evaluation/BinaryClassificationEvaluator.py
imports: from .None import SentenceEvaluator
  import logging
  import os
  import csv
  from sklearn.metrics.pairwise import paired_cosine_distances, paired_euclidean_distances, paired_manhattan_distances
  from sklearn.metrics import average_precision_score
  import numpy
  from typing import List
  from ..readers import InputExample
label_desc: Use image node_id 4 for calling the BinaryClassificationEvaluator obj's underlying member method code with example usage: obj.compute_metrices(model) and returns: output_scores