code: def process_ratings(data_dir, dataset, user_num, item_num):
      print("Loading ratings...")
      with tempfile.TemporaryDirectory() as tmpdirname:
          file_name = "ratings.dat" if dataset == "ml-1m" else "u.data"
          sep = "::" if dataset == "ml-1m" else "\t"
  
          if is_local_path(data_dir):
              local_path = os.path.join(data_dir, dataset, file_name)
          else:
              remote_path = os.path.join(data_dir, dataset, file_name)
              local_path = os.path.join(tmpdirname, file_name)
              get_remote_file_to_local(
                  remote_path=remote_path, local_path=local_path
              )
  
          ratings = pd.read_csv(
              local_path,
              sep=sep,
              header=None,
              names=["user", "item"],
              usecols=[0, 1],
              dtype={0: np.int64, 1: np.int64},
              engine="python",
          )
  
      # Load ratings as a dok matrix
      train_mat = sp.dok_matrix((user_num, item_num), dtype=np.int32)
      for x in ratings.values.tolist():
          train_mat[x[0], x[1]] = 1
      return ratings, train_mat
  
imports: import os
  import tempfile
  import numpy
  import pandas
  import scipy.sparse
  from sklearn.model_selection import train_test_split
  from sklearn.preprocessing import MinMaxScaler
  import torch.utils.data
  from bigdl.dllib.utils.file_utils import is_local_path
  from bigdl.orca.data.file import get_remote_dir_to_local, get_remote_file_to_local
label_desc: Use image node_id 3 for calling a global function with example usage: process_ratings(data_dir, dataset, user_num, item_num) and returns: ratings,  train_mat