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 _online_recommendation(self, user):
      # Algorithm 1: Online recommendation line 5
      p_0 = self.r_mat[[user]]
      p_0.data.fill(1)
      p_0 = p_0.toarray().squeeze()
      a_0 = self.Y[user].toarray().squeeze()
      u_0 = np.zeros(self.r_mat.shape[0])
      u_0[user] = 1
  
      # Algorithm 1: Online training line 6
      if p_0.any():
          p_0 /= np.linalg.norm(p_0, 1)
      if a_0.any():
          a_0 /= np.linalg.norm(a_0, 1)
      if u_0.any():
          u_0 /= np.linalg.norm(u_0, 1)
  
      # Algorithm 1: Online recommendation line 7
      p = self.p.copy()
      a = self.a.copy()
      u = self.u.copy()
  
      # Algorithm 1: Online recommendation line 8
      prev_p = p
      prev_a = a
      prev_u = u
      inc = 1
      while True:
          # eq. 4
          u_denominator = self.alpha + self.gamma + self.eta_U + EPS
          u = (
              self.alpha / u_denominator * self.R * p
              + self.gamma / u_denominator * self.Y * a
              + self.eta_U / u_denominator * u_0
          ).squeeze()
          p_denominator = self.alpha + self.beta + self.eta_P + EPS
          p = (
              self.alpha / p_denominator * self.R.T * u
              + self.beta / p_denominator * self.X * a
              + self.eta_P / p_denominator * p_0
          ).squeeze()
          a_denominator = self.gamma + self.beta + self.eta_A + EPS
          a = (
              self.gamma / a_denominator * self.Y.T * u
              + self.beta / a_denominator * self.X.T * p
              + self.eta_P / a_denominator * a_0
          ).squeeze()
  
          if (self.max_iter > 0 and inc > self.max_iter) or (
              np.all(np.isclose(u, prev_u))
              and np.all(np.isclose(p, prev_p))
              and np.all(np.isclose(a, prev_a))
          ):  # stop when converged
              break
          prev_p, prev_a, prev_u = p, a, u
          inc += 1
  
      # Algorithm 1: Online recommendation line 9
      return p, a, u
  
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 6 for calling the TriRank obj's underlying member method code with example usage: obj._online_recommendation(user) and returns: p,  a,  u