docstr: This class is base for all neighborhood-based algorithms.
  
  :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 reg_bi: Regularization factor for items
  :type reg_bi: int, default 10
  
  :param reg_bu: Regularization factor for users
  :type reg_bu: int, default 15
  
  :param similarity_metric:
  :type similarity_metric: str, default cosine
  
  :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","neighborhood-based","algorithms",".",":","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","reg_bi",":","Regularization","factor","for","items",":","type","reg_bi",":","int",",","default","10",":","param","reg_bu",":","Regularization","factor","for","users",":","type","reg_bu",":","int",",","default","15",":","param","similarity_metric",":",":","type","similarity_metric",":","str",",","default","cosine",":","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,
      reg_bi=10,
      reg_bu=15,
      similarity_metric="cosine",
      sep="\t",
      output_sep="\t",
  ):
      """
      This class is base for all neighborhood-based algorithms.
  
      :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 reg_bi: Regularization factor for items
      :type reg_bi: int, default 10
  
      :param reg_bu: Regularization factor for users
      :type reg_bu: int, default 15
  
      :param similarity_metric:
      :type similarity_metric: str, default cosine
  
      :param sep: Delimiter for input files
      :type sep: str, default'\t'
  
      :param output_sep: Delimiter for output file
      :type output_sep: str, default '\t'
  
      """
      super(BaseKNN, self).__init__(
          train_file=train_file,
          test_file=test_file,
          output_file=output_file,
          similarity_metric=similarity_metric,
          sep=sep,
          output_sep=output_sep,
      )
  
      self.reg_bi = reg_bi
      self.reg_bu = reg_bu
  
      # internal vars
      self.number_users = None
      self.number_items = None
      self.bu = {}
      self.bi = {}
      self.bui = {}
  
file_path: CaseRecommender/caserec/recommenders/rating_prediction/base_knn.py
imports: from caserec.recommenders.rating_prediction.base_rating_prediction import BaseRatingPrediction
label_desc: Use image node_id 1 to create a new BaseKNN object from inherited base classes: BaseRatingPrediction with example: obj = BaseKNN(train_file, test_file, output_file, reg_bi, reg_bu, similarity_metric, sep, output_sep)