code: def _create_sparse_ratings_matrix_helper(
      users: Iterable[int],
      items: Iterable[int],
      ratings: Optional[Iterable[int]] = None,
      num_users: Union[int, str] = "infer",
      num_items: Union[int, str] = "infer",
  ) -> coo_matrix:
      """Create a sparse matrix from a series of arrays."""
      num_users = _infer_num_if_needed_for_1d_array(num_users, users)
      num_items = _infer_num_if_needed_for_1d_array(num_items, items)
  
      if ratings is None:
          ratings = np.ones_like(users)
  
      return coo_matrix(
          (np.array(ratings), (np.array(users), np.array(items))),
          shape=(num_users, num_items),
      )
  
imports: from datetime import datetime
  import inspect
  from pathlib import Path
  import re
  import time
  from typing import Any, Dict, Iterable, List, Optional, Union
  import docstring_parser
  import numpy
  import pandas
  import pytorch_lightning
  from scipy.sparse import coo_matrix
  import torch
  from collie.interactions import Interactions
label_desc: Use image node_id 3 for calling a global function with example usage: _create_sparse_ratings_matrix_helper(users, items, ratings, num_users, num_items) and returns: coo_matrix