docstr:  This class is base for all item recommendation algorithms. Inherits the class Recommender
   and implements / adds common methods and attributes for rank approaches.
  
  :param train_file: File which contains the train set. This file needs to have at least 3 columns
  (user item feedback_value).
  :type train_file: str
  
  :param test_file: File which contains the test set. This file needs to have at least 3 columns
  (user item feedback_value).
  :type test_file: str, default None
  
  :param output_file: File with dir to write the final predictions
  :type output_file: str, default None
  
  :param similarity_metric:
  :type similarity_metric: str, default cosine
  
  :param rank_length: Size of the rank that must be generated by the predictions of the recommender algorithm
  :type rank_length: int, default 10
  
  :param as_binary: If True, the explicit feedback will be transform to binary
  :type as_binary: bool, default False
  
  :param sep: Delimiter for input files
  :type sep: str, default '       '
  
  :param output_sep: Delimiter for output file
  :type output_sep: str, default '        '
docstr_tok: ["This","class","is","base","for","all","item","recommendation","algorithms",".","Inherits","the","class","Recommender","and","implements","\/","adds","common","methods","and","attributes","for","rank","approaches",".",":","param","train_file",":","File","which","contains","the","train","set",".","This","file","needs","to","have","at","least","3","columns","(","user","item","feedback_value",")",".",":","type","train_file",":","str",":","param","test_file",":","File","which","contains","the","test","set",".","This","file","needs","to","have","at","least","3","columns","(","user","item","feedback_value",")",".",":","type","test_file",":","str",",","default","None",":","param","output_file",":","File","with","dir","to","write","the","final","predictions",":","type","output_file",":","str",",","default","None",":","param","similarity_metric",":",":","type","similarity_metric",":","str",",","default","cosine",":","param","rank_length",":","Size","of","the","rank","that","must","be","generated","by","the","predictions","of","the","recommender","algorithm",":","type","rank_length",":","int",",","default","10",":","param","as_binary",":","If","True",",","the","explicit","feedback","will","be","transform","to","binary",":","type","as_binary",":","bool",",","default","False",":","param","sep",":","Delimiter","for","input","files",":","type","sep",":","str",",","default","'","'",":","param","output_sep",":","Delimiter","for","output","file",":","type","output_sep",":","str",",","default","'","'"]
code: def __init__(
      self,
      train_file,
      test_file,
      output_file=None,
      as_binary=False,
      rank_length=10,
      similarity_metric="cosine",
      sep="\t",
      output_sep="\t",
  ):
      """
       This class is base for all item recommendation algorithms. Inherits the class Recommender
       and implements / adds common methods and attributes for rank approaches.
  
      :param train_file: File which contains the train set. This file needs to have at least 3 columns
      (user item feedback_value).
      :type train_file: str
  
      :param test_file: File which contains the test set. This file needs to have at least 3 columns
      (user item feedback_value).
      :type test_file: str, default None
  
      :param output_file: File with dir to write the final predictions
      :type output_file: str, default None
  
      :param similarity_metric:
      :type similarity_metric: str, default cosine
  
      :param rank_length: Size of the rank that must be generated by the predictions of the recommender algorithm
      :type rank_length: int, default 10
  
      :param as_binary: If True, the explicit feedback will be transform to binary
      :type as_binary: bool, default False
  
      :param sep: Delimiter for input files
      :type sep: str, default '\t'
  
      :param output_sep: Delimiter for output file
      :type output_sep: str, default '\t'
  
      """
  
      self.train_file = train_file
      self.test_file = test_file
      self.as_binary = as_binary
      self.similarity_metric = similarity_metric
      self.output_file = output_file
      self.rank_length = rank_length
      self.sep = sep
      self.output_sep = output_sep
  
      # internal vars
      self.item_to_item_id = {}
      self.item_id_to_item = {}
      self.user_to_user_id = {}
      self.user_id_to_user = {}
      self.train_set = None
      self.test_set = None
      self.users = None
      self.items = None
      self.matrix = None
      self.evaluation_results = None
      self.recommender_name = None
      self.extra_info_header = None
      self.ranking = []
  
file_path: CaseRecommender/caserec/recommenders/item_recommendation/base_item_recommendation.py
imports: from scipy.spatial.distance import squareform, pdist
  import numpy
  from caserec.evaluation.item_recommendation import ItemRecommendationEvaluation
  from caserec.utils.extra_functions import print_header
  from caserec.utils.process_data import ReadFile, WriteFile
label_desc: Use image node_id 1 to create a new BaseItemRecommendation object from inherited base classes: object with example: obj = BaseItemRecommendation(train_file, test_file, output_file, as_binary, rank_length, similarity_metric, sep, output_sep)