class_docstr: Factorization Machines.
  
  Parameters
  ----------
  k0: int, optional, default: 1
      Using bias 'w0'.
  
  k1: int, optional, default: 1
      Using first-order weights 'w'.
  
  k2: int, optional, default: 8
      Dimension of second-order weights 'v'.
  
  max_iter: int, optional, default: 100
      Maximum number of iterations or the number of epochs for SGD, SGDA.
  
  learning_rate: float, optional, default: 0.01
      The learning rate for SGD.
  
  reg0: float, optional, default: 0.0
      Bias regularization. 
  
  reg1: float, optional, default: 0.0
      First-order weights regularization. 
  
  reg2: float, optional, default: 0.0
      Second-order weights regularization. 
  
  reg_all: float, optional, default: 0.0
      Regularization for all parameters.
      If 'reg_all' != 0.0, this will be used for all regularization.
  
  init_stdev: float, optional, default: 0.1
      Standard deviation for initialization of second-order weights 'v'.
  
  method, str, optional, default: 'mcmc'
      Learning method (SGD, SGDA, ALS, MCMC)
  
  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.
  
  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, some running logs are displayed.
  
  init_params: dictionary, optional, default: None
      Initial parameters, e.g., init_params = {'w0': bias, 'w': first-order, 'v': second-order}
  
  seed: int, optional, default: None
      Random seed for weight initialization.
      If specified, training will take longer because of single-thread (no parallelization).
  
  References
  ----------
  * Rendle, S. (2010, December). Factorization machines.     In 2010 IEEE International Conference on Data Mining (pp. 995-1000). IEEE.
  
  * Rendle, S. (2012). Factorization machines with libfm.     ACM Transactions on Intelligent Systems and Technology (TIST), 3(3), 1-22.
class_docstr_tok: ["Factorization","Machines",".","Parameters","--","--","--","--","--","k0",":","int",",","optional",",","default",":","1","Using","bias","'w0","'",".","k1",":","int",",","optional",",","default",":","1","Using","first-order","weights","'","w","'",".","k2",":","int",",","optional",",","default",":","8","Dimension","of","second-order","weights","'","v","'",".","max_iter",":","int",",","optional",",","default",":","100","Maximum","number","of","iterations","or","the","number","of","epochs","for","SGD",",","SGDA",".","learning_rate",":","float",",","optional",",","default",":","0.01","The","learning","rate","for","SGD",".","reg0",":","float",",","optional",",","default",":","0.0","Bias","regularization",".","reg1",":","float",",","optional",",","default",":","0.0","First-order","weights","regularization",".","reg2",":","float",",","optional",",","default",":","0.0","Second-order","weights","regularization",".","reg_all",":","float",",","optional",",","default",":","0.0","Regularization","for","all","parameters",".","If","'reg_all","'","!","=","0.0",",","this","will","be","used","for","all","regularization",".","init_stdev",":","float",",","optional",",","default",":","0.1","Standard","deviation","for","initialization","of","second-order","weights","'","v","'",".","method",",","str",",","optional",",","default",":","'mcmc'","Learning","method","(","SGD",",","SGDA",",","ALS",",","MCMC",")","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",".","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",",","some","running","logs","are","displayed",".","init_params",":","dictionary",",","optional",",","default",":","None","Initial","parameters",",","e.g.",",","init_params","=","{","'w0","'",":","bias",",","'","w","'",":","first-order",",","'","v","'",":","second-order","}","seed",":","int",",","optional",",","default",":","None","Random","seed","for","weight","initialization",".","If","specified",",","training","will","take","longer","because","of","single-thread","(","no","parallelization",")",".","References","--","--","--","--","--","*","Rendle",",","S.","(","2010",",","December",")",".","Factorization","machines",".","In","2010","IEEE","International","Conference","on","Data","Mining","(","pp",".","995-1000",")",".","IEEE",".","*","Rendle",",","S.","(","2012",")",".","Factorization","machines","with","libfm",".","ACM","Transactions","on","Intelligent","Systems","and","Technology","(","TIST",")",",","3","(","3",")",",","1-22","."]
code: def _init(self):
      num_features = self.total_users + self.total_items
  
      if self.w0 is None:
          self.w0 = 0.0
      if self.w is None:
          self.w = zeros(num_features, dtype=np.double)
      if self.v is None:
          d = self.k2 if self.k2 else 1  # dummy if self.k2 == 0
          self.v = normal(
              (d, num_features),
              std=self.init_stdev,
              random_state=self.seed,
              dtype=np.double,
          )
  
file_path: cornac/cornac/models/fm/recom_fm.py
imports: import sys
  import multiprocessing
  import numpy
  from ..recommender import Recommender
  from ..recommender import ANNMixin, MEASURE_DOT
  from ...utils import get_rng
  from ...utils.init_utils import zeros, normal
label_desc: Use image node_id 2 for calling the FM obj's underlying member method code with example usage: obj._init() without return types