class_docstr: Evaluate a model based on a triplet: (sentence, positive_example, negative_example).
      Checks if distance(sentence, positive_example) < distance(sentence, negative_example).
docstr: :param anchors: Sentences to check similarity to. (e.g. a query)
  :param positives: List of positive sentences
  :param negatives: List of negative sentences
  :param main_distance_function: One of 0 (Cosine), 1 (Euclidean) or 2 (Manhattan). Defaults to None, returning all 3.
  :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 __init__(
      self,
      anchors: List[str],
      positives: List[str],
      negatives: List[str],
      main_distance_function: SimilarityFunction = None,
      name: str = "",
      batch_size: int = 16,
      show_progress_bar: bool = False,
      write_csv: bool = True,
  ):
      """
      :param anchors: Sentences to check similarity to. (e.g. a query)
      :param positives: List of positive sentences
      :param negatives: List of negative sentences
      :param main_distance_function: One of 0 (Cosine), 1 (Euclidean) or 2 (Manhattan). Defaults to None, returning all 3.
      :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
      """
      self.anchors = anchors
      self.positives = positives
      self.negatives = negatives
      self.name = name
  
      assert len(self.anchors) == len(self.positives)
      assert len(self.anchors) == len(self.negatives)
  
      self.main_distance_function = main_distance_function
  
      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: str = (
          "triplet_evaluation"
          + ("_" + name if name else "")
          + "_results.csv"
      )
      self.csv_headers = [
          "epoch",
          "steps",
          "accuracy_cosinus",
          "accuracy_manhattan",
          "accuracy_euclidean",
      ]
      self.write_csv = write_csv
  
file_path: sentence-transformers/sentence_transformers/evaluation/TripletEvaluator.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 typing import List
  from ..readers import InputExample
label_desc: Use image node_id 1 to create a new TripletEvaluator object from inherited base classes: SentenceEvaluator with example: obj = TripletEvaluator(anchors, positives, negatives, main_distance_function, name, batch_size, show_progress_bar, write_csv)