code: def update_cf(self, user_data, item_data):
      R_user = user_data[1]
      R_item = item_data[1]
  
      cf_loss = 0.0
  
      # update users
      VV = self.b * (self.V.T.dot(self.V)) + self.lambda_u * np.eye(
          self.k
      )
      for i in range(self.n_user):
          idx_item = user_data[0][i]
          V_i = self.V[idx_item]
          R_i = R_user[i]
          A = VV + (self.a - self.b) * (V_i.T.dot(V_i))
          x = (self.a * V_i * (np.tile(R_i, (self.k, 1)).T)).sum(0)
          self.U[i] = np.linalg.solve(A, x)
  
          cf_loss += 0.5 * self.lambda_u * np.dot(self.U[i], self.U[i])
  
      # update items
      UU = self.b * (self.U.T.dot(self.U))
      for j in range(self.n_item):
          idx_user = item_data[0][j]
          U_j = self.U[idx_user]
          R_j = R_item[j]
  
          UU_j = UU + (self.a - self.b) * (U_j.T.dot(U_j))
          A = UU_j + self.lambda_v * np.eye(self.k)
          x = (self.a * U_j * (np.tile(R_j, (self.k, 1)).T)).sum(
              0
          ) + self.lambda_v * self.theta[j]
          self.V[j] = np.linalg.solve(A, x)
  
          cf_loss += 0.5 * self.a * np.square(R_j).sum()
          cf_loss -= self.a * np.sum((U_j.dot(self.V[j])) * R_j)
          cf_loss += 0.5 * np.dot(self.V[j].dot(UU_j), self.V[j])
  
          ep = self.V[j, :] - self.theta[j, :]
          cf_loss += 0.5 * self.lambda_v * np.sum(ep * ep)
  
      return cf_loss
  
file_path: cornac/cornac/models/ctr/ctr.py
imports: import numpy
  from ...utils import get_rng
label_desc: Use image node_id 2 for calling the Model obj's underlying member method code with example usage: obj.update_cf(user_data, item_data) and returns: cf_loss