docstr: Update latent factors according to the stochastic gradient descent update rule
  
  :param u: User ID for update
  :type u: int
  
  :param i: Known Item ID
  :type i: int
  
  :param j: Unknown Item ID
  :type j: int
docstr_tok: ["Update","latent","factors","according","to","the","stochastic","gradient","descent","update","rule",":","param","u",":","User","ID","for","update",":","type","u",":","int",":","param","i",":","Known","Item","ID",":","type","i",":","int",":","param","j",":","Unknown","Item","ID",":","type","j",":","int"]
code: def update_factors(self, u, i, j):
      """
      Update latent factors according to the stochastic gradient descent update rule
  
      :param u: User ID for update
      :type u: int
  
      :param i: Known Item ID
      :type i: int
  
      :param j: Unknown Item ID
      :type j: int
      """
  
      # Compute Difference
      x_uij = (
          self.bias[i]
          - self.bias[j]
          + (self.predict_score(u, i) - self.predict_score(u, j))
      )
      eps = 1 / (1 + np.exp(x_uij))
  
      self.bias[i] += self.learn_rate * (
          eps - self.reg_bias * self.bias[i]
      )
      self.bias[j] += self.learn_rate * (
          -eps - self.reg_bias * self.bias[j]
      )
  
      # Adjust the factors
      u_f = self.p[u]
      i_f = self.q[i]
      j_f = self.q[j]
  
      # Compute and apply factor updates
      self.p[u] += self.learn_rate * (
          (i_f - j_f) * eps - self.reg_u * u_f
      )
      self.q[i] += self.learn_rate * (u_f * eps - self.reg_i * i_f)
      self.q[j] += self.learn_rate * (-u_f * eps - self.reg_j * j_f)
  
file_path: CaseRecommender/caserec/recommenders/item_recommendation/bprmf.py
imports: import random
  import numpy
  from caserec.recommenders.item_recommendation.base_item_recommendation import BaseItemRecommendation
  from caserec.utils.extra_functions import timed
label_desc: Use image node_id 7 for calling the BprMF obj's underlying member method code with example usage: obj.update_factors(u, i, j) without return types