class_docstr: Collaborative Variational Autoencoder
  
  Parameters
  ----------
  z_dim: int, optional, default: 50
      The dimension of the user and item latent factors.
  
  n_epochs: int, optional, default: 100
      Maximum number of epochs for training.
  
  lambda_u: float, optional, default: 1e-4
      The regularization hyper-parameter for user latent factor.
  
  lambda_v: float, optional, default: 0.001
      The regularization hyper-parameter for item latent factor.
  
  lambda_r: float, optional, default: 10.0
      Parameter that balance the focus on content or ratings
  
  lambda_w: float, optional, default: 1e-4
      The regularization for VAE weights
  
  lr: float, optional, default: 0.001
      Learning rate in the auto-encoder training
  
  a: float, optional, default: 1
      The confidence of observed ratings.
  
  b: float, optional, default: 0.01
      The confidence of unseen ratings.
  
  input_dim: int, optional, default: 8000
      The size of input vector
  
  vae_layers: list, optional, default: [200, 100]
      The list containing size of each layers in neural network structure
  
  act_fn: str, default: 'sigmoid'
      Name of the activation function used for the variational auto-encoder.
      Supported functions: ['sigmoid', 'tanh', 'elu', 'relu', 'relu6', 'leaky_relu', 'identity']
  
  loss_type: String, optional, default: "cross-entropy"
      Either "cross-entropy" or "rmse"
      The type of loss function in the last layer
  
  batch_size: int, optional, default: 128
      The batch size for SGD.
  
  init_params: dict, optional, default: {'U':None, 'V':None}
      Initial U and V latent matrix
  
  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).
  
  References
  ----------
  Collaborative Variational Autoencoder for Recommender Systems
  X. Li and J. She ACM SIGKDD International Conference on Knowledge Discovery and Data Mining 2017
  
  http://eelxpeng.github.io/assets/paper/Collaborative_Variational_Autoencoder.pdf
class_docstr_tok: ["Collaborative","Variational","Autoencoder","Parameters","--","--","--","--","--","z_dim",":","int",",","optional",",","default",":","50","The","dimension","of","the","user","and","item","latent","factors",".","n_epochs",":","int",",","optional",",","default",":","100","Maximum","number","of","epochs","for","training",".","lambda_u",":","float",",","optional",",","default",":","1e-4","The","regularization","hyper-parameter","for","user","latent","factor",".","lambda_v",":","float",",","optional",",","default",":","0.001","The","regularization","hyper-parameter","for","item","latent","factor",".","lambda_r",":","float",",","optional",",","default",":","10.0","Parameter","that","balance","the","focus","on","content","or","ratings","lambda_w",":","float",",","optional",",","default",":","1e-4","The","regularization","for","VAE","weights","lr",":","float",",","optional",",","default",":","0.001","Learning","rate","in","the","auto-encoder","training","a",":","float",",","optional",",","default",":","1","The","confidence","of","observed","ratings",".","b",":","float",",","optional",",","default",":","0.01","The","confidence","of","unseen","ratings",".","input_dim",":","int",",","optional",",","default",":","8000","The","size","of","input","vector","vae_layers",":","list",",","optional",",","default",":","[","200",",","100","]","The","list","containing","size","of","each","layers","in","neural","network","structure","act_fn",":","str",",","default",":","'sigmoid'","Name","of","the","activation","function","used","for","the","variational","auto-encoder",".","Supported","functions",":","[","'sigmoid","'",",","'tanh","'",",","'elu","'",",","'relu","'",",","'relu6","'",",","'leaky_relu","'",",","'identity","'","]","loss_type",":","String",",","optional",",","default",":","``","cross-entropy","''","Either","``","cross-entropy","''","or","``","rmse","''","The","type","of","loss","function","in","the","last","layer","batch_size",":","int",",","optional",",","default",":","128","The","batch","size","for","SGD",".","init_params",":","dict",",","optional",",","default",":","{","'","U","'",":","None",",","'","V","'",":","None","}","Initial","U","and","V","latent","matrix","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",")",".","References","--","--","--","--","--","Collaborative","Variational","Autoencoder","for","Recommender","Systems","X.","Li","and","J",".","She","ACM","SIGKDD","International","Conference","on","Knowledge","Discovery","and","Data","Mining","2017","http",":","\/\/eelxpeng.github.io\/assets\/paper\/Collaborative_Variational_Autoencoder.pdf"]
docstr: Predict the scores/ratings of a user for an item.
  
  Parameters
  ----------
  user_idx: int, required
      The index of the user for whom to perform score prediction.
  
  item_idx: int, optional, default: None
      The index of the item for which to perform score prediction.
      If None, scores for all known items will be returned.
  
  Returns
  -------
  res : A scalar or a Numpy array
      Relative scores that the user gives to the item or to all known items
docstr_tok: ["Predict","the","scores\/ratings","of","a","user","for","an","item",".","Parameters","--","--","--","--","--","user_idx",":","int",",","required","The","index","of","the","user","for","whom","to","perform","score","prediction",".","item_idx",":","int",",","optional",",","default",":","None","The","index","of","the","item","for","which","to","perform","score","prediction",".","If","None",",","scores","for","all","known","items","will","be","returned",".","Returns","--","--","--","-","res",":","A","scalar","or","a","Numpy","array","Relative","scores","that","the","user","gives","to","the","item","or","to","all","known","items"]
code: def score(self, user_idx, item_idx=None):
      """Predict the scores/ratings of a user for an item.
  
      Parameters
      ----------
      user_idx: int, required
          The index of the user for whom to perform score prediction.
  
      item_idx: int, optional, default: None
          The index of the item for which to perform score prediction.
          If None, scores for all known items will be returned.
  
      Returns
      -------
      res : A scalar or a Numpy array
          Relative scores that the user gives to the item or to all known items
  
      """
      if self.is_unknown_user(user_idx):
          raise ScoreException(
              "Can't make score prediction for user %d" % user_idx
          )
  
      if item_idx is not None and self.is_unknown_item(item_idx):
          raise ScoreException(
              "Can't make score prediction for item %d" % item_idx
          )
  
      if item_idx is None:
          return self.V.dot(self.U[user_idx, :])
  
      return self.V[item_idx, :].dot(self.U[user_idx, :])
  
file_path: cornac/cornac/models/cvae/recom_cvae.py
imports: import numpy
  from tqdm.auto import trange
  from ..recommender import Recommender
  from ..recommender import ANNMixin, MEASURE_DOT
  from ...exception import ScoreException
  from ...utils import get_rng
  from ...utils.init_utils import xavier_uniform
label_desc: Use image node_id 5 for calling the CVAE obj's underlying member method code with example usage: obj.score(user_idx, item_idx) and returns: self, self