class_docstr: Adversarial Training Towards Robust Multimedia Recommender System.
  
  Parameters
  ----------
  k: int, optional, default: 10
      The dimension of the gamma latent factors.
  
  k2: int, optional, default: 10
      The dimension of the theta latent factors.
  
  n_epochs: int, optional, default: 20
      Maximum number of epochs for SGD.
  
  batch_size: int, optional, default: 100
      The batch size for SGD.
  
  learning_rate: float, optional, default: 0.001
      The learning rate for SGD.
  
  lambda_w: float, optional, default: 0.01
      The regularization hyper-parameter for latent factor weights.
  
  lambda_b: float, optional, default: 0.01
      The regularization hyper-parameter for biases.
  
  lambda_e: float, optional, default: 0.0
      The regularization hyper-parameter for embedding matrix E and beta prime vector.
  
  lambda_adv: float, optional, default: 1.0
      The regularization hyper-parameter in Eq. (8) and (10) for the adversarial sample loss.
  
  use_gpu: boolean, optional, default: True
      Whether or not to use GPU to speed up training.
  
  trainable: boolean, optional, default: True
      When False, the model is not trained and Cornac assumes that the model already         pre-trained (U and V are not None).
  
  verbose: boolean, optional, default: True
      When True, running logs are displayed.
  
  init_params: dictionary, optional, default: None
      Initial parameters, e.g., init_params = {'Bi': beta_item, 'Gu': gamma_user,
      'Gi': gamma_item, 'Tu': theta_user, 'E': emb_matrix, 'Bp': beta_prime}
  
  seed: int, optional, default: None
      Random seed for weight initialization.
  
  References
  ----------
  * Tang, J., Du, X., He, X., Yuan, F., Tian, Q., and Chua, T. (2020). Adversarial Training Towards Robust Multimedia Recommender System.
class_docstr_tok: ["Adversarial","Training","Towards","Robust","Multimedia","Recommender","System",".","Parameters","--","--","--","--","--","k",":","int",",","optional",",","default",":","10","The","dimension","of","the","gamma","latent","factors",".","k2",":","int",",","optional",",","default",":","10","The","dimension","of","the","theta","latent","factors",".","n_epochs",":","int",",","optional",",","default",":","20","Maximum","number","of","epochs","for","SGD",".","batch_size",":","int",",","optional",",","default",":","100","The","batch","size","for","SGD",".","learning_rate",":","float",",","optional",",","default",":","0.001","The","learning","rate","for","SGD",".","lambda_w",":","float",",","optional",",","default",":","0.01","The","regularization","hyper-parameter","for","latent","factor","weights",".","lambda_b",":","float",",","optional",",","default",":","0.01","The","regularization","hyper-parameter","for","biases",".","lambda_e",":","float",",","optional",",","default",":","0.0","The","regularization","hyper-parameter","for","embedding","matrix","E","and","beta","prime","vector",".","lambda_adv",":","float",",","optional",",","default",":","1.0","The","regularization","hyper-parameter","in","Eq",".","(","8",")","and","(","10",")","for","the","adversarial","sample","loss",".","use_gpu",":","boolean",",","optional",",","default",":","True","Whether","or","not","to","use","GPU","to","speed","up","training",".","trainable",":","boolean",",","optional",",","default",":","True","When","False",",","the","model","is","not","trained","and","Cornac","assumes","that","the","model","already","pre-trained","(","U","and","V","are","not","None",")",".","verbose",":","boolean",",","optional",",","default",":","True","When","True",",","running","logs","are","displayed",".","init_params",":","dictionary",",","optional",",","default",":","None","Initial","parameters",",","e.g.",",","init_params","=","{","'Bi","'",":","beta_item",",","'Gu","'",":","gamma_user",",","'Gi","'",":","gamma_item",",","'Tu","'",":","theta_user",",","'","E","'",":","emb_matrix",",","'Bp","'",":","beta_prime","}","seed",":","int",",","optional",",","default",":","None","Random","seed","for","weight","initialization",".","References","--","--","--","--","--","*","Tang",",","J.",",","Du",",","X.",",","He",",","X.",",","Yuan",",","F.",",","Tian",",","Q.",",","and","Chua",",","T.","(","2020",")",".","Adversarial","Training","Towards","Robust","Multimedia","Recommender","System","."]
code: def _init(self, n_users, n_items, features):
      rng = get_rng(self.seed)
  
      if self.gamma_user is None:
          self.gamma_user = xavier_uniform((n_users, self.k), rng)
      if self.gamma_item is None:
          self.gamma_item = xavier_uniform((n_items, self.k), rng)
      if self.emb_matrix is None:
          self.emb_matrix = xavier_uniform(
              (features.shape[1], self.k), rng
          )
  
      # pre-computed for faster evaluation
      self.theta_item = np.matmul(features, self.emb_matrix)
  
file_path: cornac/cornac/models/amr/recom_amr.py
imports: import numpy
  from tqdm.auto import tqdm
  from ..recommender import Recommender
  from ..recommender import ANNMixin, MEASURE_DOT
  from ...exception import CornacException
  from ...utils import fast_dot
  from ...utils import get_rng
  from ...utils.init_utils import xavier_uniform
label_desc: Use image node_id 2 for calling the AMR obj's underlying member method code with example usage: obj._init(n_users, n_items, features) without return types