code: def cosine_similarity(cooccurrence):
      """Helper method to calculate the Cosine similarity of a matrix of
      co-occurrences.
  
      Cosine similarity can be interpreted as the angle between the i-th
      and j-th item.
  
      Args:
          cooccurrence (numpy.ndarray): The symmetric matrix of co-occurrences of items.
  
      Returns:
          numpy.ndarray: The matrix of cosine similarity between any two items.
  
      """
  
      diag_rows, diag_cols = _get_row_and_column_matrix(
          cooccurrence.diagonal()
      )
  
      with np.errstate(invalid="ignore", divide="ignore"):
          result = cooccurrence / np.sqrt(diag_rows * diag_cols)
  
      return np.array(result)
  
file_path: recommenders/recommenders/utils/python_utils.py
imports: import logging
  import numpy
  from scipy import sparse
label_desc: Use image node_id 7 for calling a global function with example usage: cosine_similarity(cooccurrence) and returns: np