docstr: ItemNSVD1 for rating prediction
  
  Usage::
  
      >> ItemNSVD1(train, test, metadata_file='user_metadata.dat').compute()
      >> ItemNSVD1(train, test, metadata_file='user_metadata.dat', batch=True).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 metadata_file: File which contains the metadata set. This file needs to have at least 2 columns
  (user metadata).
  :type metadata_file: str
  
  :param output_file: File with dir to write the final predictions
  :type output_file: str, default None
  
  :param epochs: Number of epochs over the training data
  :type epochs: int, default 10
  
  :param learn_rate: Learning rate (alpha)
  :type learn_rate: float, default 0.05
  
  :param delta: Regularization value
  :type delta: float, default 0.015
  
  :param factors: Number of latent factors per user/item
  :type factors: int, default 10
  
  :param init_mean: Mean of the normal distribution used to initialize the latent factors
  :type init_mean: float, default 0
  
  :param init_stdev: Standard deviation of the normal distribution used to initialize the latent factors
  :type init_stdev: float, default 0.1
  
  :param stop_criteria: Difference between errors for stopping criteria
  :type stop_criteria: float, default 0.001
  
  :param batch: Tf True, use batch model to train the model
  :type batch: bool, default False
  
  :param n2: Number of interactions in batch step
  :type n2: int, default 10
  
  :param learn_rate2: Learning rate in batch step
  :type learn_rate2: float, default 0.01
  
  :param delta2: Regularization value in Batch step
  :type delta2: float, default 0.015
  
  :param sep: Delimiter for input files
  :type sep: str, default '       '
  
  :param output_sep: Delimiter for output file
  :type output_sep: str, default '        '
  
  :param metadata_sep: Delimiter for similarity or metadata file
  :type metadata_sep: str, default '      '
  
  :param metadata_as_binary: f True, the explicit value will be transform to binary
  :type metadata_as_binary: bool, default False
  
  :param random_seed: Number of seed. Lock random numbers for reproducibility of experiments.
  :type random_seed: int, default None
docstr_tok: ["ItemNSVD1","for","rating","prediction","Usage",":",":",">",">","ItemNSVD1","(","train",",","test",",","metadata_file='user_metadata.dat","'",")",".compute","(",")",">",">","ItemNSVD1","(","train",",","test",",","metadata_file='user_metadata.dat","'",",","batch=True",")",".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","metadata_file",":","File","which","contains","the","metadata","set",".","This","file","needs","to","have","at","least","2","columns","(","user","metadata",")",".",":","type","metadata_file",":","str",":","param","output_file",":","File","with","dir","to","write","the","final","predictions",":","type","output_file",":","str",",","default","None",":","param","epochs",":","Number","of","epochs","over","the","training","data",":","type","epochs",":","int",",","default","10",":","param","learn_rate",":","Learning","rate","(","alpha",")",":","type","learn_rate",":","float",",","default","0.05",":","param","delta",":","Regularization","value",":","type","delta",":","float",",","default","0.015",":","param","factors",":","Number","of","latent","factors","per","user\/item",":","type","factors",":","int",",","default","10",":","param","init_mean",":","Mean","of","the","normal","distribution","used","to","initialize","the","latent","factors",":","type","init_mean",":","float",",","default","0",":","param","init_stdev",":","Standard","deviation","of","the","normal","distribution","used","to","initialize","the","latent","factors",":","type","init_stdev",":","float",",","default","0.1",":","param","stop_criteria",":","Difference","between","errors","for","stopping","criteria",":","type","stop_criteria",":","float",",","default","0.001",":","param","batch",":","Tf","True",",","use","batch","model","to","train","the","model",":","type","batch",":","bool",",","default","False",":","param","n2",":","Number","of","interactions","in","batch","step",":","type","n2",":","int",",","default","10",":","param","learn_rate2",":","Learning","rate","in","batch","step",":","type","learn_rate2",":","float",",","default","0.01",":","param","delta2",":","Regularization","value","in","Batch","step",":","type","delta2",":","float",",","default","0.015",":","param","sep",":","Delimiter","for","input","files",":","type","sep",":","str",",","default","'","'",":","param","output_sep",":","Delimiter","for","output","file",":","type","output_sep",":","str",",","default","'","'",":","param","metadata_sep",":","Delimiter","for","similarity","or","metadata","file",":","type","metadata_sep",":","str",",","default","'","'",":","param","metadata_as_binary",":","f","True",",","the","explicit","value","will","be","transform","to","binary",":","type","metadata_as_binary",":","bool",",","default","False",":","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,
      metadata_file=None,
      output_file=None,
      epochs=30,
      learn_rate=0.01,
      delta=0.015,
      factors=10,
      init_mean=0,
      init_stdev=0.1,
      stop_criteria=0.001,
      batch=False,
      n2=10,
      learn_rate2=0.01,
      delta2=0.015,
      sep="\t",
      output_sep="\t",
      metadata_sep="\t",
      metadata_as_binary=False,
      random_seed=None,
  ):
      """
      ItemNSVD1 for rating prediction
  
      Usage::
  
          >> ItemNSVD1(train, test, metadata_file='user_metadata.dat').compute()
          >> ItemNSVD1(train, test, metadata_file='user_metadata.dat', batch=True).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 metadata_file: File which contains the metadata set. This file needs to have at least 2 columns
      (user metadata).
      :type metadata_file: str
  
      :param output_file: File with dir to write the final predictions
      :type output_file: str, default None
  
      :param epochs: Number of epochs over the training data
      :type epochs: int, default 10
  
      :param learn_rate: Learning rate (alpha)
      :type learn_rate: float, default 0.05
  
      :param delta: Regularization value
      :type delta: float, default 0.015
  
      :param factors: Number of latent factors per user/item
      :type factors: int, default 10
  
      :param init_mean: Mean of the normal distribution used to initialize the latent factors
      :type init_mean: float, default 0
  
      :param init_stdev: Standard deviation of the normal distribution used to initialize the latent factors
      :type init_stdev: float, default 0.1
  
      :param stop_criteria: Difference between errors for stopping criteria
      :type stop_criteria: float, default 0.001
  
      :param batch: Tf True, use batch model to train the model
      :type batch: bool, default False
  
      :param n2: Number of interactions in batch step
      :type n2: int, default 10
  
      :param learn_rate2: Learning rate in batch step
      :type learn_rate2: float, default 0.01
  
      :param delta2: Regularization value in Batch step
      :type delta2: float, default 0.015
  
      :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 metadata_sep: Delimiter for similarity or metadata file
      :type metadata_sep: str, default '\t'
  
      :param metadata_as_binary: f True, the explicit value will be transform to binary
      :type metadata_as_binary: bool, default False
  
      :param random_seed: Number of seed. Lock random numbers for reproducibility of experiments.
      :type random_seed: int, default None
  
      """
  
      super(ItemNSVD1, self).__init__(
          train_file=train_file,
          test_file=test_file,
          output_file=output_file,
          factors=factors,
          init_mean=init_mean,
          init_stdev=init_stdev,
          sep=sep,
          output_sep=output_sep,
          random_seed=random_seed,
      )
  
      self.recommender_name = "ItemNSVD1"
  
      self.metadata_file = metadata_file
      self.batch = batch
      self.epochs = epochs
      self.learn_rate = learn_rate
      self.delta = delta
      self.stop_criteria = stop_criteria
      self.n2 = n2
      self.learn_rate2 = learn_rate2
      self.delta2 = delta2
      self.metadata_sep = metadata_sep
      self.metadata_as_binary = metadata_as_binary
  
      # internal vars
      self.x = None
      self.non_zero_x = None
      self.d = None
  
file_path: CaseRecommender/caserec/recommenders/rating_prediction/item_nsvd1.py
imports: import numpy
  from caserec.recommenders.rating_prediction.base_nsvd1 import BaseNSVD1
  from caserec.utils.extra_functions import timed
  from caserec.utils.process_data import ReadFile
label_desc: Use image node_id 1 to create a new ItemNSVD1 object from inherited base classes: BaseNSVD1 with example: obj = ItemNSVD1(train_file, test_file, metadata_file, output_file, epochs, learn_rate, delta, factors, init_mean, init_stdev, stop_criteria, batch, n2, learn_rate2, delta2, sep, output_sep, metadata_sep, metadata_as_binary, random_seed)