class_docstr: This class evaluates an Information Retrieval (IR) setting.
  
  Given a set of queries and a large corpus set. It will retrieve for each query the top-k most similar document. It measures
  Mean Reciprocal Rank (MRR), Recall@k, and Normalized Discounted Cumulative Gain (NDCG)
class_docstr_tok: ["This","class","evaluates","an","Information","Retrieval","(","IR",")","setting",".","Given","a","set","of","queries","and","a","large","corpus","set",".","It","will","retrieve","for","each","query","the","top-k","most","similar","document",".","It","measures","Mean","Reciprocal","Rank","(","MRR",")",",","Recall","@","k",",","and","Normalized","Discounted","Cumulative","Gain","(","NDCG",")"]
code: def __call__(
      self,
      model,
      output_path: str = None,
      epoch: int = -1,
      steps: int = -1,
      *args,
      **kwargs,
  ) -> float:
      if epoch != -1:
          out_txt = (
              " after epoch {}:".format(epoch)
              if steps == -1
              else " in epoch {} after {} steps:".format(epoch, steps)
          )
      else:
          out_txt = ":"
  
      logger.info(
          "Information Retrieval Evaluation on "
          + self.name
          + " dataset"
          + out_txt
      )
  
      scores = self.compute_metrices(model, *args, **kwargs)
  
      # Write results to disc
      if output_path is not None and self.write_csv:
          csv_path = os.path.join(output_path, self.csv_file)
          if not os.path.isfile(csv_path):
              fOut = open(csv_path, mode="w", encoding="utf-8")
              fOut.write(",".join(self.csv_headers))
              fOut.write("\n")
  
          else:
              fOut = open(csv_path, mode="a", encoding="utf-8")
  
          output_data = [epoch, steps]
          for name in self.score_function_names:
              for k in self.accuracy_at_k:
                  output_data.append(scores[name]["accuracy@k"][k])
  
              for k in self.precision_recall_at_k:
                  output_data.append(scores[name]["precision@k"][k])
                  output_data.append(scores[name]["recall@k"][k])
  
              for k in self.mrr_at_k:
                  output_data.append(scores[name]["mrr@k"][k])
  
              for k in self.ndcg_at_k:
                  output_data.append(scores[name]["ndcg@k"][k])
  
              for k in self.map_at_k:
                  output_data.append(scores[name]["map@k"][k])
  
          fOut.write(",".join(map(str, output_data)))
          fOut.write("\n")
          fOut.close()
  
      if self.main_score_function is None:
          return max(
              [
                  scores[name]["map@k"][max(self.map_at_k)]
                  for name in self.score_function_names
              ]
          )
      else:
          return scores[self.main_score_function]["map@k"][
              max(self.map_at_k)
          ]
  
file_path: sentence-transformers/sentence_transformers/evaluation/InformationRetrievalEvaluator.py
imports: from .None import SentenceEvaluator
  import torch
  from torch import Tensor
  import logging
  from tqdm import trange
  from ..util import cos_sim, dot_score
  import os
  import numpy
  from typing import List, Dict, Set, Callable
  import heapq
label_desc: Use image node_id 2 for calling the InformationRetrievalEvaluator obj's underlying member method code with example usage: obj.__call__(model, output_path, epoch, steps) and returns: max, scores