docstr: Method to treat and initialize the model. Extends init_model from BaseNSVD1
docstr_tok: ["Method","to","treat","and","initialize","the","model",".","Extends","init_model","from","BaseNSVD1"]
code: def init_model(self):
      """
      Method to treat and initialize the model. Extends init_model from BaseNSVD1
  
      """
  
      super(UserNSVD1, self).init_model()
  
      self.non_zero_x = []
      self.d = []
  
      self.metadata = ReadFile(
          self.metadata_file,
          sep=self.metadata_sep,
          as_binary=self.metadata_as_binary,
      ).read_metadata_or_similarity()
  
      # create metadata matrix (user x metadata)
      self.x = np.zeros(
          (self.number_users, len(self.metadata["col_2"]))
      )
  
      meta_to_meta_id = {}
      for m, data in enumerate(self.metadata["col_2"]):
          meta_to_meta_id[data] = m
  
      for user_m in self.metadata["col_1"]:
          for m1 in self.metadata["dict"][user_m]:
              self.x[
                  self.user_to_user_id[user_m], meta_to_meta_id[m1]
              ] = self.metadata["dict"][user_m][m1]
  
      # create header info for metadata
      sparsity = (
          1
          - (
              self.metadata["number_interactions"]
              / (
                  len(self.metadata["col_1"])
                  * len(self.metadata["col_2"])
              )
          )
      ) * 100
  
      self.extra_info_header = (
          ">> metadata:: %d users and %d metadata (%d interactions) | sparsity:: %.2f%%"
          % (
              len(self.metadata["col_1"]),
              len(self.metadata["col_2"]),
              self.metadata["number_interactions"],
              sparsity,
          )
      )
  
      self.number_metadata = len(self.metadata["col_2"])
  
      for u in range(self.number_users):
          self.non_zero_x.append(list(np.where(self.x[u] != 0)[0]))
          with np.errstate(divide="ignore"):
              self.d.append(1 / np.dot(self.x[u].T, self.x[u]))
  
      # Create Factors
      self.create_factors()
  
file_path: CaseRecommender/caserec/recommenders/rating_prediction/user_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 2 for calling the UserNSVD1 obj's underlying member method code with example usage: obj.init_model() without return types