docstr: Matrix Factorization for rating prediction
  
  Matrix factorization models map both users and items to a joint latent factor space of dimensionality f,
  such that user-item interactions are modeled as inner products in that space.
  
  Usage::
  
      >> MatrixFactorization(train, test).compute()
  
  :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 factors: Number of latent factors per user/item
  :type factors: int, default 10
  
  :param sep: Delimiter for input files
  :type sep: str, default '       '
  
  :param output_sep: Delimiter for output file
  :type output_sep: str, default '        '
  
  :param random_seed: Number of seed. Lock random numbers for reproducibility of experiments.
  :type random_seed: int, default None
docstr_tok: ["Matrix","Factorization","for","rating","prediction","Matrix","factorization","models","map","both","users","and","items","to","a","joint","latent","factor","space","of","dimensionality","f",",","such","that","user-item","interactions","are","modeled","as","inner","products","in","that","space",".","Usage",":",":",">",">","MatrixFactorization","(","train",",","test",")",".compute","(",")",":","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","factors",":","Number","of","latent","factors","per","user\/item",":","type","factors",":","int",",","default","10",":","param","sep",":","Delimiter","for","input","files",":","type","sep",":","str",",","default","'","'",":","param","output_sep",":","Delimiter","for","output","file",":","type","output_sep",":","str",",","default","'","'",":","param","random_seed",":","Number","of","seed",".","Lock","random","numbers","for","reproducibility","of","experiments",".",":","type","random_seed",":","int",",","default","None"]
code: def __init__(
      self,
      train_file=None,
      test_file=None,
      output_file=None,
      factors=10,
      sep="\t",
      output_sep="\t",
      random_seed=None,
  ):
      """
      Matrix Factorization for rating prediction
  
      Matrix factorization models map both users and items to a joint latent factor space of dimensionality f,
      such that user-item interactions are modeled as inner products in that space.
  
      Usage::
  
          >> MatrixFactorization(train, test).compute()
  
      :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 factors: Number of latent factors per user/item
      :type factors: int, default 10
  
      :param sep: Delimiter for input files
      :type sep: str, default '\t'
  
      :param output_sep: Delimiter for output file
      :type output_sep: str, default '\t'
  
      :param random_seed: Number of seed. Lock random numbers for reproducibility of experiments.
      :type random_seed: int, default None
  
      """
      super(SVD, self).__init__(
          train_file=train_file,
          test_file=test_file,
          output_file=output_file,
          sep=sep,
          output_sep=output_sep,
      )
  
      self.recommender_name = "SVD"
      self.factors = factors
  
      if random_seed is not None:
          np.random.seed(random_seed)
  
      # internal vars
      self.feedback_triples = None
      self.prediction_matrix = None
  
file_path: CaseRecommender/caserec/recommenders/rating_prediction/svd.py
imports: import numpy
  from scipy.sparse.linalg import svds
  from caserec.recommenders.rating_prediction.base_rating_prediction import BaseRatingPrediction
  from caserec.utils.extra_functions import timed
label_desc: Use image node_id 1 to create a new SVD object from inherited base classes: BaseRatingPrediction with example: obj = SVD(train_file, test_file, output_file, factors, sep, output_sep, random_seed)