class_docstr: This class evaluates a SentenceTransformer model for the task of re-ranking.
  
  Given a query and a list of documents, it computes the score [query, doc_i] for all possible
  documents and sorts them in decreasing order. Then, MRR@10 and MAP is compute to measure the quality of the ranking.
  
  :param samples: Must be a list and each element is of the form: {'query': '', 'positive': [], 'negative': []}. Query is the search query,
   positive is a list of positive (relevant) documents, negative is a list of negative (irrelevant) documents.
code: def __call__(
      self,
      model,
      output_path: str = None,
      epoch: int = -1,
      steps: int = -1,
  ) -> float:
      if epoch != -1:
          if steps == -1:
              out_txt = " after epoch {}:".format(epoch)
          else:
              out_txt = " in epoch {} after {} steps:".format(
                  epoch, steps
              )
      else:
          out_txt = ":"
  
      logger.info(
          "RerankingEvaluator: Evaluating the model on "
          + self.name
          + " dataset"
          + out_txt
      )
  
      scores = self.compute_metrices(model)
      mean_ap = scores["map"]
      mean_mrr = scores["mrr"]
  
      #### Some stats about the dataset
      num_positives = [
          len(sample["positive"]) for sample in self.samples
      ]
      num_negatives = [
          len(sample["negative"]) for sample in self.samples
      ]
  
      logger.info(
          "Queries: {} \t Positives: Min {:.1f}, Mean {:.1f}, Max {:.1f} \t Negatives: Min {:.1f}, Mean {:.1f}, Max {:.1f}".format(
              len(self.samples),
              np.min(num_positives),
              np.mean(num_positives),
              np.max(num_positives),
              np.min(num_negatives),
              np.mean(num_negatives),
              np.max(num_negatives),
          )
      )
      logger.info("MAP: {:.2f}".format(mean_ap * 100))
      logger.info(
          "MRR@{}: {:.2f}".format(self.mrr_at_k, mean_mrr * 100)
      )
  
      #### Write results to disc
      if output_path is not None and self.write_csv:
          csv_path = os.path.join(output_path, self.csv_file)
          output_file_exists = os.path.isfile(csv_path)
          with open(
              csv_path,
              newline="",
              mode="a" if output_file_exists else "w",
              encoding="utf-8",
          ) as f:
              writer = csv.writer(f)
              if not output_file_exists:
                  writer.writerow(self.csv_headers)
  
              writer.writerow([epoch, steps, mean_ap, mean_mrr])
  
      return mean_ap
  
file_path: sentence-transformers/sentence_transformers/evaluation/RerankingEvaluator.py
imports: from .None import SentenceEvaluator
  import logging
  import numpy
  import os
  import csv
  from ..util import cos_sim
  import torch
  from sklearn.metrics import average_precision_score
  import tqdm
label_desc: Use image node_id 2 for calling the RerankingEvaluator obj's underlying member method code with example usage: obj.__call__(model, output_path, epoch, steps) and returns: mean_ap