class_docstr: Parameters
  ----------
  name: string, default: 'HRDR'
      The name of the recommender model.
  
  embedding_size: int, default: 100
      Word embedding size
  
  n_factors: int, default: 32
      The dimension of the user/item's latent factors.
  
  attention_size: int, default: 16
      Attention size
  
  kernel_sizes: list, default: [3]
      List of kernel sizes of conv2d
  
  n_filters: int, default: 64
      Number of filters
  
  n_user_mlp_factors: int, default: 128
      Number of latent dimension of the first layer of a 3-layer MLP following by batch normalization on user net to represent user rating.
  
  n_item_mlp_factors: int, default: 128
      Number of latent dimension of the first layer of a 3-layer MLP following by batch normalization on item net to represent item rating.
  
  dropout_rate: float, default: 0.5
      Dropout rate of neural network dense layers
  
  max_text_length: int, default: 50
      Maximum number of tokens in a review instance
  
  max_num_review: int, default: 32
      Maximum number of reviews that you want to feed into training. By default, the model will be trained with all reviews.
  
  batch_size: int, default: 64
      Batch size
  
  max_iter: int, default: 20
      Max number of training epochs
  
  optimizer: string, optional, default: 'adam'
      Optimizer for training is either 'adam' or 'rmsprop'.
  
  learning_rate: float, optional, default: 0.001
      Initial value of learning rate for the optimizer.
  
  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, running logs are displayed.
  
  init_params: dictionary, optional, default: None
      Initial parameters, pretrained_word_embeddings could be initialized here, e.g., init_params={'pretrained_word_embeddings': pretrained_word_embeddings}
  
  seed: int, optional, default: None
      Random seed for weight initialization.
      If specified, training will take longer because of single-thread (no parallelization).
  
  References
  ----------
  Liu, H., Wang, Y., Peng, Q., Wu, F., Gan, L., Pan, L., & Jiao, P. (2020). Hybrid neural recommendation with joint deep representation learning of ratings and reviews. Neurocomputing, 374, 77-85.
class_docstr_tok: ["Parameters","--","--","--","--","--","name",":","string",",","default",":","'HRDR'","The","name","of","the","recommender","model",".","embedding_size",":","int",",","default",":","100","Word","embedding","size","n_factors",":","int",",","default",":","32","The","dimension","of","the","user\/item","'s","latent","factors",".","attention_size",":","int",",","default",":","16","Attention","size","kernel_sizes",":","list",",","default",":","[","3","]","List","of","kernel","sizes","of","conv2d","n_filters",":","int",",","default",":","64","Number","of","filters","n_user_mlp_factors",":","int",",","default",":","128","Number","of","latent","dimension","of","the","first","layer","of","a","3-layer","MLP","following","by","batch","normalization","on","user","net","to","represent","user","rating",".","n_item_mlp_factors",":","int",",","default",":","128","Number","of","latent","dimension","of","the","first","layer","of","a","3-layer","MLP","following","by","batch","normalization","on","item","net","to","represent","item","rating",".","dropout_rate",":","float",",","default",":","0.5","Dropout","rate","of","neural","network","dense","layers","max_text_length",":","int",",","default",":","50","Maximum","number","of","tokens","in","a","review","instance","max_num_review",":","int",",","default",":","32","Maximum","number","of","reviews","that","you","want","to","feed","into","training",".","By","default",",","the","model","will","be","trained","with","all","reviews",".","batch_size",":","int",",","default",":","64","Batch","size","max_iter",":","int",",","default",":","20","Max","number","of","training","epochs","optimizer",":","string",",","optional",",","default",":","'adam'","Optimizer","for","training","is","either","'adam","'","or","'rmsprop","'",".","learning_rate",":","float",",","optional",",","default",":","0.001","Initial","value","of","learning","rate","for","the","optimizer",".","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",",","running","logs","are","displayed",".","init_params",":","dictionary",",","optional",",","default",":","None","Initial","parameters",",","pretrained_word_embeddings","could","be","initialized","here",",","e.g.",",","init_params=","{","'pretrained_word_embeddings","'",":","pretrained_word_embeddings","}","seed",":","int",",","optional",",","default",":","None","Random","seed","for","weight","initialization",".","If","specified",",","training","will","take","longer","because","of","single-thread","(","no","parallelization",")",".","References","--","--","--","--","--","Liu",",","H.",",","Wang",",","Y.",",","Peng",",","Q.",",","Wu",",","F.",",","Gan",",","L.",",","Pan",",","L.",",","&","Jiao",",","P.","(","2020",")",".","Hybrid","neural","recommendation","with","joint","deep","representation","learning","of","ratings","and","reviews",".","Neurocomputing",",","374",",","77-85","."]
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 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
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","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_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 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
      """
      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:
          h0 = self.P[user_idx] * self.Q
          known_item_scores = (
              h0.dot(self.W1) + self.bu[user_idx] + self.bi + self.mu
          )
          return known_item_scores.ravel()
      else:
          h0 = self.P[user_idx] * self.Q[item_idx]
          known_item_score = (
              h0.dot(self.W1)
              + self.bu[user_idx]
              + self.bi[item_idx]
              + self.mu
          )
          return known_item_score
  
file_path: cornac/cornac/models/hrdr/recom_hrdr.py
imports: import os
  import pickle
  from tqdm.auto import trange
  from ..recommender import Recommender
  from ..recommender import ANNMixin, MEASURE_DOT
  from ...exception import ScoreException
label_desc: Use image node_id 6 for calling the HRDR obj's underlying member method code with example usage: obj.score(user_idx, item_idx) and returns: known_item_scores, known_item_score