class_docstr: Matrix Factorization.
  
  Parameters
  ----------
  k: int, optional, default: 10
      The dimension of the latent factors.
  
  backend: str, optional, default: 'cpu'
      Backend used for model training: cpu, pytorch
  
  optimizer: str, optional, default: 'sgd'
      Specify an optimizer: adagrad, adam, rmsprop, sgd. (ineffective if using CPU backend)
      
  max_iter: int, optional, default: 100
      Maximum number of iterations or the number of epochs for training.
  
  learning_rate: float, optional, default: 0.01
      The learning rate.
      
  batch_size: int, optional, default: 256
      Batch size (ineffective if using CPU backend).
  
  lambda_reg: float, optional, default: 0.001
      The lambda value used for regularization.
      
  dropout: float, optional, default: 0.0
      The dropout rate of embedding. (ineffective if using CPU backend)
  
  use_bias: boolean, optional, default: True
      When True, user, item, and global biases are used.
  
  early_stop: boolean, optional, default: False
      When True, delta loss will be checked after each iteration to stop learning earlier.
  
  num_threads: int, optional, default: 0
      Number of parallel threads for training. If num_threads=0, all CPU cores will be utilized.
      If seed is not None, num_threads=1 to remove randomness from parallelization. 
      (Only effective if using CPU backend).
  
  trainable: boolean, optional, default: True
      When False, the model will not be re-trained, and input of pre-trained parameters are required.
  
  verbose: boolean, optional, default: True
      When True, running logs are displayed.
  
  init_params: dictionary, optional, default: None
      Initial parameters, e.g., init_params = {'U': user_factors, 'V': item_factors,
      'Bu': user_biases, 'Bi': item_biases}
  
  seed: int, optional, default: None
      Random seed for weight initialization.
      If specified, training will take longer because of single-thread (no parallelization).
  
  References
  ----------
  * Koren, Y., Bell, R., & Volinsky, C. Matrix factorization techniques for recommender systems.     In Computer, (8), 30-37. 2009.
class_docstr_tok: ["Matrix","Factorization",".","Parameters","--","--","--","--","--","k",":","int",",","optional",",","default",":","10","The","dimension","of","the","latent","factors",".","backend",":","str",",","optional",",","default",":","'cpu'","Backend","used","for","model","training",":","cpu",",","pytorch","optimizer",":","str",",","optional",",","default",":","'sgd'","Specify","an","optimizer",":","adagrad",",","adam",",","rmsprop",",","sgd",".","(","ineffective","if","using","CPU","backend",")","max_iter",":","int",",","optional",",","default",":","100","Maximum","number","of","iterations","or","the","number","of","epochs","for","training",".","learning_rate",":","float",",","optional",",","default",":","0.01","The","learning","rate",".","batch_size",":","int",",","optional",",","default",":","256","Batch","size","(","ineffective","if","using","CPU","backend",")",".","lambda_reg",":","float",",","optional",",","default",":","0.001","The","lambda","value","used","for","regularization",".","dropout",":","float",",","optional",",","default",":","0.0","The","dropout","rate","of","embedding",".","(","ineffective","if","using","CPU","backend",")","use_bias",":","boolean",",","optional",",","default",":","True","When","True",",","user",",","item",",","and","global","biases","are","used",".","early_stop",":","boolean",",","optional",",","default",":","False","When","True",",","delta","loss","will","be","checked","after","each","iteration","to","stop","learning","earlier",".","num_threads",":","int",",","optional",",","default",":","0","Number","of","parallel","threads","for","training",".","If","num_threads=0",",","all","CPU","cores","will","be","utilized",".","If","seed","is","not","None",",","num_threads=1","to","remove","randomness","from","parallelization",".","(","Only","effective","if","using","CPU","backend",")",".","trainable",":","boolean",",","optional",",","default",":","True","When","False",",","the","model","will","not","be","re-trained",",","and","input","of","pre-trained","parameters","are","required",".","verbose",":","boolean",",","optional",",","default",":","True","When","True",",","running","logs","are","displayed",".","init_params",":","dictionary",",","optional",",","default",":","None","Initial","parameters",",","e.g.",",","init_params","=","{","'","U","'",":","user_factors",",","'","V","'",":","item_factors",",","'Bu","'",":","user_biases",",","'Bi","'",":","item_biases","}","seed",":","int",",","optional",",","default",":","None","Random","seed","for","weight","initialization",".","If","specified",",","training","will","take","longer","because","of","single-thread","(","no","parallelization",")",".","References","--","--","--","--","--","*","Koren",",","Y.",",","Bell",",","R.",",","&","Volinsky",",","C.","Matrix","factorization","techniques","for","recommender","systems",".","In","Computer",",","(","8",")",",","30-37",".","2009","."]
code: def _init(self):
      rng = get_rng(self.seed)
  
      if self.u_factors is None:
          self.u_factors = normal(
              [self.num_users, self.k], std=0.01, random_state=rng
          )
      if self.i_factors is None:
          self.i_factors = normal(
              [self.num_items, self.k], std=0.01, random_state=rng
          )
  
      self.u_biases = (
          zeros(self.num_users)
          if self.u_biases is None
          else self.u_biases
      )
      self.i_biases = (
          zeros(self.num_items)
          if self.i_biases is None
          else self.i_biases
      )
      self.global_mean = self.global_mean if self.use_bias else 0.0
  
file_path: cornac/cornac/models/mf/recom_mf.py
imports: import multiprocessing
  import numpy
  from ..recommender import Recommender
  from ..recommender import ANNMixin, MEASURE_DOT
  from ...exception import ScoreException
  from ...utils import fast_dot
  from ...utils import get_rng
  from ...utils.init_utils import normal, zeros
label_desc: Use image node_id 2 for calling the MF obj's underlying member method code with example usage: obj._init() without return types