class_docstr: Conditional Variational Autoencoder for Collaborative Filtering.
  
  Parameters
  ----------
  z_dim: int, optional, default: 20
      The dimension of the stochastic user factors ``z'' representing the preference information.
  
  h_dim: int, optional, default: 20
      The dimension of the stochastic user factors ``h'' representing the auxiliary data.
  
  autoencoder_structure: list, default: [20]
      The number of neurons of encoder/decoder hidden layer for CVAE.
      For example, when autoencoder_structure = [20],
      the CVAE encoder structures will be [y_dim, 20, z_dim] and [x_dim, 20, h_dim],
      the decoder structure will be [z_dim + h_dim, 20, y_dim], where y and x are respectively the preference and         auxiliary data.
  
  act_fn: str, default: 'tanh'
      Name of the activation function used between hidden layers of the auto-encoder.
      Supported functions: ['sigmoid', 'tanh', 'elu', 'relu', 'relu6']
  
  likelihood: str, default: 'mult'
      Name of the likelihood function used for modeling user preferences.
      Supported choices:
  
      mult: Multinomial likelihood
      bern: Bernoulli likelihood
      gaus: Gaussian likelihood
      pois: Poisson likelihood
  
  n_epochs: int, optional, default: 100
      The number of epochs for SGD.
  
  batch_size: int, optional, default: 128
      The batch size.
  
  learning_rate: float, optional, default: 0.001
      The learning rate for Adam.
  
  beta: float, optional, default: 1.0
      The weight of the KL term KL(q(z|y)||p(z)) as in beta-VAE.
  
  alpha_1: float, optional, default: 1.0
      The weight of the KL term KL(q(h|x)||p(h|x)).
  
  alpha_2: float, optional, default: 1.0
      The weight of the KL term KL(q(h|x)||q(h|y)).
  
  name: string, optional, default: 'CVAECF'
      The name of the recommender model.
  
  trainable: boolean, optional, default: True
      When False, the model is not trained, and Cornac assumes that the model is already         pre-trained.
  
  verbose: boolean, optional, default: False
      When True, some running logs are displayed.
  
  seed: int, optional, default: None
      Random seed for parameters initialization.
  
  use_gpu: boolean, optional, default: False
      If True and your system supports CUDA then training is performed on GPUs.
  
  user auxiliary data : See "cornac/examples/cvaecf_filmtrust.py" for an example of how to use         cornac's graph modality to load and provide the ``user network'' for CVAECF.
  
  References
  ----------
  * Lee, Wonsung, Kyungwoo Song, and Il-Chul Moon. "Augmented variational autoencoders for collaborative filtering      with auxiliary information." Proceedings of ACM CIKM. 2017.
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
          )
  
      import torch
  
      if item_idx is None:
          y_u = self.r_mat[user_idx].copy()
          y_u.data = np.ones(len(y_u.data))
          y_u = torch.tensor(
              y_u.A, dtype=torch.float32, device=self.device
          )
          z_u, _ = self.cvae.encode_qz(y_u)
  
          x_u = self.u_adj_mat[user_idx].copy()
          x_u.data = np.ones(len(x_u.data))
          x_u = torch.tensor(
              x_u.A, dtype=torch.float32, device=self.device
          )
          h_u, _ = self.cvae.encode_qhx(x_u)
  
          known_item_scores = (
              self.cvae.decode(z_u, h_u).data.cpu().numpy().flatten()
          )
          return known_item_scores
      else:
          y_u = self.r_mat[user_idx].copy()
          y_u.data = np.ones(len(y_u.data))
          y_u = torch.tensor(
              y_u.A, dtype=torch.float32, device=self.device
          )
          z_u, _ = self.cvae.encode_qz(y_u)
  
          x_u = self.u_adj_mat[user_idx].copy()
          x_u.data = np.ones(len(x_u.data))
          x_u = torch.tensor(
              x_u.A, dtype=torch.float32, device=self.device
          )
          h_u, _ = self.cvae.encode_qhx(x_u)
  
          user_pred = (
              self.cvae.decode(z_u, h_u)
              .data.cpu()
              .numpy()
              .flatten()[item_idx]
          )
          return user_pred
  
file_path: cornac/cornac/models/cvaecf/recom_cvaecf.py
imports: import numpy
  from ..recommender import Recommender
  from ...exception import ScoreException
label_desc: Use image node_id 3 for calling the CVAECF obj's underlying member method code with example usage: obj.score(user_idx, item_idx) and returns: known_item_scores, user_pred