class_docstr: Evaluate a model based on the similarity of the embeddings by calculating the Spearman and Pearson rank correlation
  in comparison to the gold standard labels.
  The metrics are the cosine similarity as well as euclidean and Manhattan distance
  The returned score is the Spearman correlation with a specified metric.
  
  The results are written in a CSV. If a CSV already exists, then values are appended.
class_docstr_tok: ["Evaluate","a","model","based","on","the","similarity","of","the","embeddings","by","calculating","the","Spearman","and","Pearson","rank","correlation","in","comparison","to","the","gold","standard","labels",".","The","metrics","are","the","cosine","similarity","as","well","as","euclidean","and","Manhattan","distance","The","returned","score","is","the","Spearman","correlation","with","a","specified","metric",".","The","results","are","written","in","a","CSV",".","If","a","CSV","already","exists",",","then","values","are","appended","."]
docstr: Constructs an evaluator based for the dataset
  
  The labels need to indicate the similarity between the sentences.
  
  :param sentences1:  List with the first sentence in a pair
  :param sentences2: List with the second sentence in a pair
  :param scores: Similarity score between sentences1[i] and sentences2[i]
  :param write_csv: Write results to a CSV file
docstr_tok: ["Constructs","an","evaluator","based","for","the","dataset","The","labels","need","to","indicate","the","similarity","between","the","sentences",".",":","param","sentences1",":","List","with","the","first","sentence","in","a","pair",":","param","sentences2",":","List","with","the","second","sentence","in","a","pair",":","param","scores",":","Similarity","score","between","sentences1","[","i","]","and","sentences2","[","i","]",":","param","write_csv",":","Write","results","to","a","CSV","file"]
code: def __init__(
      self,
      sentences1: List[str],
      sentences2: List[str],
      scores: List[float],
      batch_size: int = 16,
      main_similarity: SimilarityFunction = None,
      name: str = "",
      show_progress_bar: bool = False,
      write_csv: bool = True,
  ):
      """
      Constructs an evaluator based for the dataset
  
      The labels need to indicate the similarity between the sentences.
  
      :param sentences1:  List with the first sentence in a pair
      :param sentences2: List with the second sentence in a pair
      :param scores: Similarity score between sentences1[i] and sentences2[i]
      :param write_csv: Write results to a CSV file
      """
      self.sentences1 = sentences1
      self.sentences2 = sentences2
      self.scores = scores
      self.write_csv = write_csv
  
      assert len(self.sentences1) == len(self.sentences2)
      assert len(self.sentences1) == len(self.scores)
  
      self.main_similarity = main_similarity
      self.name = name
  
      self.batch_size = batch_size
      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 = (
          "similarity_evaluation"
          + ("_" + name if name else "")
          + "_results.csv"
      )
      self.csv_headers = [
          "epoch",
          "steps",
          "cosine_pearson",
          "cosine_spearman",
          "euclidean_pearson",
          "euclidean_spearman",
          "manhattan_pearson",
          "manhattan_spearman",
          "dot_pearson",
          "dot_spearman",
      ]
  
file_path: sentence-transformers/sentence_transformers/evaluation/EmbeddingSimilarityEvaluator.py
imports: from .None import SentenceEvaluator, SimilarityFunction
  import logging
  import os
  import csv
  from sklearn.metrics.pairwise import paired_cosine_distances, paired_euclidean_distances, paired_manhattan_distances
  from scipy.stats import pearsonr, spearmanr
  import numpy
  from typing import List
  from ..readers import InputExample
label_desc: Use image node_id 1 to create a new EmbeddingSimilarityEvaluator object from inherited base classes: SentenceEvaluator with example: obj = EmbeddingSimilarityEvaluator(sentences1, sentences2, scores, batch_size, main_similarity, name, show_progress_bar, write_csv)