code: def jaccard(cooccurrence):
      """Helper method to calculate the Jaccard similarity of a matrix of
      co-occurrences.  When comparing Jaccard with count co-occurrence
      and lift similarity, count favours predictability, meaning that
      the most popular items will be recommended most of the time. Lift,
      by contrast, favours discoverability/serendipity, meaning that an
      item that is less popular overall but highly favoured by a small
      subset of users is more likely to be recommended. Jaccard is a
      compromise between the two.
  
      Args:
          cooccurrence (numpy.ndarray): the symmetric matrix of co-occurrences of items.
  
      Returns:
          numpy.ndarray: The matrix of Jaccard similarities between any two items.
  
      """
  
      diag_rows, diag_cols = _get_row_and_column_matrix(
          cooccurrence.diagonal()
      )
  
      with np.errstate(invalid="ignore", divide="ignore"):
          result = cooccurrence / (diag_rows + diag_cols - cooccurrence)
  
      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 3 for calling a global function with example usage: jaccard(cooccurrence) and returns: np