class_docstr: RecVAE, a recommender system based on a Variational Autoencoder.
  
  Parameters
  ----------
  name : str, optional, default: 'RecVae'
      Name of the recommender model.
  
  hidden_dim : int, optional, default: 600
      Dimension of the hidden layer in the VAE architecture.
  
  latent_dim : int, optional, default: 200
      Dimension of the latent layer in the VAE architecture.
  
  batch_size : int, optional, default: 500
      Size of the batches used during training.
  
  beta : float, optional
      Weighting factor for the KL divergence term in the VAE loss function.
  
  gamma : float, optional, default: 0.005
      Weighting factor for the regularization term in the loss function.
  
  lr : float, optional, default: 5e-4
      Learning rate for the optimizer.
  
  n_epochs : int, optional, default: 50
      Number of epochs to train the model.
  
  n_enc_epochs : int, optional, default: 3
      Number of epochs to train the encoder part of VAE.
  
  n_dec_epochs : int, optional, default: 1
      Number of epochs to train the decoder part of VAE.
  
  not_alternating : boolean, optional, default: False
      If True, the model training will not alternate between encoder and decoder.
  
  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: False
      When True, running logs are displayed.
  
  seed : int, optional
      Random seed for weight initialization and training reproducibility.
  
  use_gpu : boolean, optional, default: True
      When True, training utilizes GPU if available.
  
  References
  ----------
  * RecVAE GitHub Repository: https://github.com/ilya-shenbin/RecVAE
  * Paper Link: https://arxiv.org/abs/1912.11160
docstr: Predict the scores/ratings of a user for an item.
  
  Parameters
  ----------
  user_id: int, required
      The index of the user for whom to perform score prediction.
  
  item_id: int, optional, default: None
      The index of the item for that 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_id: int, required
          The index of the user for whom to perform score prediction.
  
      item_id: int, optional, default: None
          The index of the item for that 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
      """
      import torch
  
      ratings_in = self.mydata.matrix[user_idx, :]
      ratings_pred = (
          self.recvae_model(
              torch.Tensor(ratings_in.toarray()).to(self.device),
              calculate_loss=False,
          )
          .cpu()
          .detach()
          .numpy()
          .flatten()
      )
  
      if item_idx is None:
          if not self.knows_user(user_idx):
              raise ScoreException(
                  "Can't make score prediction for (user_id=%d)"
                  % user_idx
              )
  
          return ratings_pred
      else:
          if not (
              self.knows_user(user_idx) and self.knows_item(item_idx)
          ):
              raise ScoreException(
                  "Can't make score prediction for (user_id=%d, item_id=%d)"
                  % (user_idx, item_idx)
              )
  
          return ratings_pred[item_idx]
  
file_path: cornac/cornac/models/recvae/recom_recvae.py
imports: import numpy
  from tqdm.auto import trange
  from ..recommender import Recommender
  from ...exception import ScoreException
label_desc: Use image node_id 4 for calling the RecVAE obj's underlying member method code with example usage: obj.score(user_idx, item_idx) and returns: ratings_pred, ratings_pred