code: def _build_interaction_matrix(rows, cols, data):
      """
      Build the training matrix (no_users, no_items),
      with ratings >= 4.0 being marked as positive and
      the rest as negative.
      """
  
      mat = sp.lil_matrix((rows, cols), dtype=np.int32)
  
      for uid, iid, rating, timestamp in data:
          if rating >= 4.0:
              mat[uid, iid] = 1.0
          else:
              mat[uid, iid] = -1.0
  
      return mat.tocoo()
  
file_path: lightfm/examples/movielens/data.py
imports: import itertools
  import os
  import zipfile
  import numpy
  import requests
  import scipy.sparse
label_desc: Use image node_id 5 for calling a global function with example usage: _build_interaction_matrix(rows, cols, data) and returns: mat