class_docstr: TriRank: Review-aware Explainable Recommendation by Modeling Aspects.
  
  Parameters
  ----------
  name: string, optional, default: 'TriRank'
      The name of the recommender model.
  
  alpha: float, optional, default: 1
      The weight of smoothness on user-item relation
  
  beta: float, optional, default: 1
      The weight of smoothness on item-aspect relation
  
  gamma: float, optional, default: 1
      The weight of smoothness on user-aspect relation
  
  eta_U: float, optional, default: 1
      The weight of fitting constraint on users
  
  eta_P: float, optional, default: 1
      The weight of fitting constraint on items
  
  eta_A: float, optional, default: 1
      The weight of fitting constraint on aspects
  
  max_iter: int, optional, default: 100
      Maximum number of iterations to stop online training. If set to `max_iter=-1`,         the online training will stop when model parameters are converged.
  
  trainable: boolean, optional, default: True
      When False, the model is not trained and Cornac assumes that the model already         pre-trained (R, X, Y, p, a, u are not None).
  
  verbose: boolean, optional, default: False
      When True, running logs are displayed.
  
  init_params: dictionary, optional, default: None
      List of initial parameters, e.g., init_params = {'R':R, 'X':X, 'Y':Y, 'p':p, 'a':a, 'u':u}
  
      R: csr_matrix, shape (n_users, n_items)
          The symmetric normalized of edge weight matrix of user-item relation, optional initialization via init_params
  
      X: csr_matrix, shape (n_users, n_aspects)
          The symmetric normalized of edge weight matrix of user-aspect relation, optional initialization via init_params
  
      Y: csr_matrix, shape (n_items, n_aspects)
          The symmetric normalized of edge weight matrix of item-aspect relation, optional initialization via init_params
  
      p: ndarray, shape (n_items,)
          Initialized item weights, optional initialization via init_params
  
      a: ndarray, shape (n_aspects,)
          Initialized aspect weights, optional initialization via init_params
  
      u: ndarray, shape (n_aspects,)
          Initialized user weights, optional initialization via init_params
  
  seed: int, optional, default: None
      Random seed for parameters initialization.
  
  References
  ----------
  He, Xiangnan, Tao Chen, Min-Yen Kan, and Xiao Chen. 2014.     TriRank: Review-aware Explainable Recommendation by Modeling Aspects.     In the 24th ACM international on conference on information and knowledge management (CIKM'15).     ACM, New York, NY, USA, 1661-1670. DOI: https://doi.org/10.1145/2806416.2806504
code: def _create_matrices(self, train_set):
      from time import time
  
      self.r_mat = train_set.csr_matrix
  
      start_time = time()
      if self.verbose:
          print("Building matrices started!")
      sentiment_modality = train_set.sentiment
      n_users = train_set.num_users
      n_items = train_set.num_items
      n_aspects = sentiment_modality.num_aspects
  
      X_row = []
      X_col = []
      X_data = []
      Y_row = []
      Y_col = []
      Y_data = []
      for uid, isid in tqdm(
          sentiment_modality.user_sentiment.items(),
          disable=not self.verbose,
          desc="Building matrices",
      ):
          for iid, sid in isid.items():
              aos = sentiment_modality.sentiment[sid]
              aids = set(
                  aid for aid, _, _ in aos
              )  # Only one per review/sid
              for aid in aids:
                  X_row.append(iid)
                  X_col.append(aid)
                  X_data.append(1)
                  Y_row.append(uid)
                  Y_col.append(aid)
                  Y_data.append(1)
  
      # Algorithm 1: Offline training line 2
      X = csr_matrix(
          (X_data, (X_row, X_col)), shape=(n_items, n_aspects)
      )
      Y = csr_matrix(
          (Y_data, (Y_row, Y_col)), shape=(n_users, n_aspects)
      )
  
      # Algorithm 1: Offline training line 3
      X.data = np.log2(X.data) + 1
      Y.data = np.log2(Y.data) + 1
  
      # Algorithm 1: Offline training line 4
      if self.verbose:
          print("Building symmetric normalized matrices R, X, Y")
      self.R = self._symmetrical_normalization(train_set.csr_matrix)
      self.X = self._symmetrical_normalization(X)
      self.Y = self._symmetrical_normalization(Y)
  
      if self.verbose:
          total_time = time() - start_time
          print("Building matrices completed in %d s" % total_time)
  
file_path: cornac/cornac/models/trirank/recom_trirank.py
imports: import numpy
  from scipy.sparse import csr_matrix
  from tqdm.auto import tqdm
  from ..recommender import Recommender
  from ...utils import get_rng
  from ...utils.init_utils import uniform
  from ...exception import ScoreException
label_desc: Use image node_id 4 for calling the TriRank obj's underlying member method code with example usage: obj._create_matrices(train_set) without return types