code: def augment_inner_product_matrix(factors):
      """This function transforms a factor matrix such that an angular nearest neighbours search
      will return top related items of the inner product.
  
      This involves transforming each row by adding one extra dimension as suggested in the paper:
      "Speeding Up the Xbox Recommender System Using a Euclidean Transformation for Inner-Product
      Spaces" https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/XboxInnerProduct.pdf
  
      Basically this involves transforming each feature vector so that they have the same norm, which
      means the cosine of this transformed vector is proportional to the dot product (if the other
      vector in the cosine has a 0 in the extra dimension)."""
      norms = np.linalg.norm(factors, axis=1)
      max_norm = norms.max()
  
      # add an extra dimension so that the norm of each row is the same
      # (max_norm)
      extra_dimension = np.sqrt(max_norm**2 - norms**2)
      return max_norm, np.append(
          factors, extra_dimension.reshape(norms.shape[0], 1), axis=1
      )
  
file_path: implicit/implicit/utils.py
imports: import time
  import warnings
  import numpy
  import scipy.sparse
  import threadpoolctl
label_desc: Use image node_id 4 for calling a global function with example usage: augment_inner_product_matrix(factors) and returns: max_norm,  np