class_docstr: :class:`SequentialDataset` is based on :class:`~recbole.data.dataset.dataset.Dataset`,
  and provides augmentation interface to adapt to Sequential Recommendation,
  which can accelerate the data loader.
  
  Attributes:
      max_item_list_len (int): Max length of historical item list.
      item_list_length_field (str): Field name for item lists' length.
docstr: Get sparse matrix that describe interactions between user_id and item_id.
  Sparse matrix has shape (user_num, item_num).
  For a row of <src, tgt>, ``matrix[src, tgt] = 1`` if ``value_field`` is ``None``,
  else ``matrix[src, tgt] = self.inter_feat[src, tgt]``.
  
  Args:
      form (str, optional): Sparse matrix format. Defaults to ``coo``.
      value_field (str, optional): Data of sparse matrix, which should exist in ``df_feat``.
          Defaults to ``None``.
  
  Returns:
      scipy.sparse: Sparse matrix in form ``coo`` or ``csr``.
docstr_tok: ["Get","sparse","matrix","that","describe","interactions","between","user_id","and","item_id",".","Sparse","matrix","has","shape","(","user_num",",","item_num",")",".","For","a","row","of","<","src",",","tgt",">",",","``","matrix","[","src",",","tgt","]","=","1","``","if","``","value_field","``","is","``","None","``",",","else","``","matrix","[","src",",","tgt","]","=","self.inter_feat","[","src",",","tgt","]","``",".","Args",":","form","(","str",",","optional",")",":","Sparse","matrix","format",".","Defaults","to","``","coo","``",".","value_field","(","str",",","optional",")",":","Data","of","sparse","matrix",",","which","should","exist","in","``","df_feat","``",".","Defaults","to","``","None","``",".","Returns",":","scipy.sparse",":","Sparse","matrix","in","form","``","coo","``","or","``","csr","``","."]
code: def inter_matrix(self, form="coo", value_field=None):
      """Get sparse matrix that describe interactions between user_id and item_id.
      Sparse matrix has shape (user_num, item_num).
      For a row of <src, tgt>, ``matrix[src, tgt] = 1`` if ``value_field`` is ``None``,
      else ``matrix[src, tgt] = self.inter_feat[src, tgt]``.
  
      Args:
          form (str, optional): Sparse matrix format. Defaults to ``coo``.
          value_field (str, optional): Data of sparse matrix, which should exist in ``df_feat``.
              Defaults to ``None``.
  
      Returns:
          scipy.sparse: Sparse matrix in form ``coo`` or ``csr``.
      """
      if not self.uid_field or not self.iid_field:
          raise ValueError(
              "dataset does not exist uid/iid, thus can not converted to sparse matrix."
          )
  
      l1_idx = self.inter_feat[self.item_list_length_field] == 1
      l1_inter_dict = self.inter_feat[l1_idx].interaction
      new_dict = {}
      list_suffix = self.config["LIST_SUFFIX"]
      candidate_field_set = set()
      for field in l1_inter_dict:
          if (
              field != self.uid_field
              and field + list_suffix in l1_inter_dict
          ):
              candidate_field_set.add(field)
              new_dict[field] = torch.cat(
                  [
                      self.inter_feat[field],
                      l1_inter_dict[field + list_suffix][:, 0],
                  ]
              )
          elif (not field.endswith(list_suffix)) and (
              field != self.item_list_length_field
          ):
              new_dict[field] = torch.cat(
                  [self.inter_feat[field], l1_inter_dict[field]]
              )
      local_inter_feat = Interaction(new_dict)
      return self._create_sparse_matrix(
          local_inter_feat,
          self.uid_field,
          self.iid_field,
          form,
          value_field,
      )
  
file_path: RecBole/recbole/data/dataset/sequential_dataset.py
imports: import numpy
  import torch
  from recbole.data.dataset import Dataset
  from recbole.data.interaction import Interaction
  from recbole.utils.enum_type import FeatureType, FeatureSource
label_desc: Use image node_id 6 for calling the SequentialDataset obj's underlying member method code with example usage: obj.inter_matrix(form, value_field) and returns: self