class_docstr: Base class for loading datasets.
  
  Note that you should never instantiate the :class:`Dataset` class directly
  (same goes for its derived classes), but instead use one of the three
  available methods for loading datasets.
code: def construct_trainset(self, raw_trainset):
      raw2inner_id_users = {}
      raw2inner_id_items = {}
  
      current_u_index = 0
      current_i_index = 0
  
      ur = defaultdict(list)
      ir = defaultdict(list)
  
      # user raw id, item raw id, translated rating, time stamp
      for urid, irid, r, timestamp in raw_trainset:
          try:
              uid = raw2inner_id_users[urid]
          except KeyError:
              uid = current_u_index
              raw2inner_id_users[urid] = current_u_index
              current_u_index += 1
          try:
              iid = raw2inner_id_items[irid]
          except KeyError:
              iid = current_i_index
              raw2inner_id_items[irid] = current_i_index
              current_i_index += 1
  
          ur[uid].append((iid, r))
          ir[iid].append((uid, r))
  
      n_users = len(ur)  # number of users
      n_items = len(ir)  # number of items
      n_ratings = len(raw_trainset)
  
      trainset = Trainset(
          ur,
          ir,
          n_users,
          n_items,
          n_ratings,
          self.reader.rating_scale,
          raw2inner_id_users,
          raw2inner_id_items,
      )
  
      return trainset
  
imports: import itertools
  import os
  import sys
  from collections import defaultdict
  from .builtin_datasets import BUILTIN_DATASETS, download_builtin_dataset
  from .reader import Reader
  from .trainset import Trainset
label_desc: Use image node_id 7 for calling the Dataset obj's underlying member method code with example usage: obj.construct_trainset(raw_trainset) and returns: trainset