code: def process_users_items(data_dir, dataset):
      sparse_features = ["gender", "zipcode", "category", "occupation"]
      dense_features = ["age"]
  
      print("Loading user and movie data...")
      with tempfile.TemporaryDirectory() as tmpdirname:
          if is_local_path(data_dir):
              local_dir = os.path.join(data_dir, dataset)
          else:
              get_remote_dir_to_local(
                  remote_dir=os.path.join(data_dir, dataset),
                  local_dir=tmpdirname,
              )
              local_dir = os.path.join(tmpdirname, dataset)
  
          if dataset == "ml-1m":
              users = pd.read_csv(
                  os.path.join(local_dir, "users.dat"),
                  sep="::",
                  header=None,
                  names=[
                      "user",
                      "gender",
                      "age",
                      "occupation",
                      "zipcode",
                  ],
                  usecols=[0, 1, 2, 3, 4],
                  dtype={
                      0: np.int64,
                      1: str,
                      2: np.int32,
                      3: np.int64,
                      4: str,
                  },
                  engine="python",
              )
              items = pd.read_csv(
                  os.path.join(local_dir, "movies.dat"),
                  sep="::",
                  header=None,
                  names=["item", "category"],
                  usecols=[0, 2],
                  dtype={0: np.int64, 1: str},
                  engine="python",
                  encoding="latin-1",
              )
          else:  # ml-100k
              users = pd.read_csv(
                  os.path.join(local_dir, "u.user"),
                  sep="|",
                  header=None,
                  names=[
                      "user",
                      "age",
                      "gender",
                      "occupation",
                      "zipcode",
                  ],
                  usecols=[0, 1, 2, 3, 4],
                  dtype={
                      0: np.int64,
                      1: np.int32,
                      2: str,
                      3: str,
                      4: str,
                  },
              )
              items = pd.read_csv(
                  os.path.join(local_dir, "u.item"),
                  sep="|",
                  header=None,
                  names=["item"] + [f"col{i}" for i in range(19)],
                  usecols=[0] + list(range(5, 24)),
                  dtype=np.int64,
                  encoding="latin-1",
              )
  
              # Merge multiple one-hot columns into one category column
              items["category"] = items.iloc[:, 1:].apply(
                  lambda x: "".join(str(x)), axis=1
              )
              items.drop(
                  columns=[f"col{i}" for i in range(19)], inplace=True
              )
  
      user_num = users["user"].max() + 1
      item_num = items["item"].max() + 1
  
      # Categorical encoding
      for i in sparse_features:
          df = users if i in users.columns else items
          df[i], _ = pd.Series(df[i]).factorize()
  
      # Scale dense features
      for i in dense_features:
          scaler = MinMaxScaler()
          df = users if i in users.columns else items
          # MinMaxScaler needs the input to be 2-dim tensor, not 1-dim.
          values = df[i].values.reshape(-1, 1)
          values = scaler.fit_transform(values)
          values = [np.array(v, dtype=np.float32) for v in values]
          df[i] = values
  
      feature_cols = ["user", "item"] + sparse_features + dense_features
      label_cols = ["label"]
      return (
          users,
          items,
          user_num,
          item_num,
          sparse_features,
          dense_features,
          feature_cols + label_cols,
      )
  
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 1 for calling a global function with example usage: process_users_items(data_dir, dataset) and returns: users,  items,  user_num,  item_num,  sparse_features,  dense_features,  unknown