docstr: Class to evaluate predictions in a item recommendation (ranking) scenario
  
  :param sep: Delimiter for input files
  :type sep: str, default '       '
  
  :param n_ranks: List of positions to evaluate the ranking
  :type n_ranks: list, default [1, 3, 5, 10]
  
  :param metrics: List of evaluation metrics
  :type metrics: list, default ('PREC', 'RECALL', 'MAP', 'NDCG')
  
  :param all_but_one_eval: If True, considers only one pair (u, i) from the test set to evaluate the ranking
  :type all_but_one_eval: bool, default False
  
  :param verbose: Print the evaluation results
  :type verbose: bool, default True
  
  :param as_table: Print the evaluation results as table (only work with verbose=True)
  :type as_table: bool, default False
  
  :param table_sep: Delimiter for print results (only work with verbose=True and as_table=True)
  :type table_sep: str, default ' '
docstr_tok: ["Class","to","evaluate","predictions","in","a","item","recommendation","(","ranking",")","scenario",":","param","sep",":","Delimiter","for","input","files",":","type","sep",":","str",",","default","'","'",":","param","n_ranks",":","List","of","positions","to","evaluate","the","ranking",":","type","n_ranks",":","list",",","default","[","1",",","3",",","5",",","10","]",":","param","metrics",":","List","of","evaluation","metrics",":","type","metrics",":","list",",","default","(","'PREC","'",",","'RECALL","'",",","'MAP","'",",","'NDCG","'",")",":","param","all_but_one_eval",":","If","True",",","considers","only","one","pair","(","u",",","i",")","from","the","test","set","to","evaluate","the","ranking",":","type","all_but_one_eval",":","bool",",","default","False",":","param","verbose",":","Print","the","evaluation","results",":","type","verbose",":","bool",",","default","True",":","param","as_table",":","Print","the","evaluation","results","as","table","(","only","work","with","verbose=True",")",":","type","as_table",":","bool",",","default","False",":","param","table_sep",":","Delimiter","for","print","results","(","only","work","with","verbose=True","and","as_table=True",")",":","type","table_sep",":","str",",","default","'","'"]
code: def __init__(
      self,
      sep="\t",
      n_ranks=list([1, 3, 5, 10]),
      metrics=list(["PREC", "RECALL", "MAP", "NDCG"]),
      all_but_one_eval=False,
      verbose=True,
      as_table=False,
      table_sep="\t",
  ):
      """
      Class to evaluate predictions in a item recommendation (ranking) scenario
  
      :param sep: Delimiter for input files
      :type sep: str, default '\t'
  
      :param n_ranks: List of positions to evaluate the ranking
      :type n_ranks: list, default [1, 3, 5, 10]
  
      :param metrics: List of evaluation metrics
      :type metrics: list, default ('PREC', 'RECALL', 'MAP', 'NDCG')
  
      :param all_but_one_eval: If True, considers only one pair (u, i) from the test set to evaluate the ranking
      :type all_but_one_eval: bool, default False
  
      :param verbose: Print the evaluation results
      :type verbose: bool, default True
  
      :param as_table: Print the evaluation results as table (only work with verbose=True)
      :type as_table: bool, default False
  
      :param table_sep: Delimiter for print results (only work with verbose=True and as_table=True)
      :type table_sep: str, default '\t'
  
      """
  
      if type(metrics) == list:
          metrics = [m + "@" + str(n) for m in metrics for n in n_ranks]
      super(ItemRecommendationEvaluation, self).__init__(
          sep=sep,
          metrics=metrics,
          all_but_one_eval=all_but_one_eval,
          verbose=verbose,
          as_table=as_table,
          table_sep=table_sep,
      )
  
      self.n_ranks = n_ranks
  
file_path: CaseRecommender/caserec/evaluation/item_recommendation.py
imports: import numpy
  import random
  from caserec.evaluation.base_evaluation import BaseEvaluation
  from caserec.evaluation.item_recomendation_functions import precision_at_k, mean_average_precision, ndcg_at_k
label_desc: Use image node_id 1 to create a new ItemRecommendationEvaluation object from inherited base classes: BaseEvaluation with example: obj = ItemRecommendationEvaluation(sep, n_ranks, metrics, all_but_one_eval, verbose, as_table, table_sep)