class_docstr: Training set contains preference matrix
  
  Parameters
  ----------
  num_users: int, required
      Number of users.
  
  num_items: int, required
      Number of items.
  
  uid_map: :obj:`OrderDict`, required
      The dictionary containing mapping from user original ids to mapped integer indices.
  
  iid_map: :obj:`OrderDict`, required
      The dictionary containing mapping from item original ids to mapped integer indices.
  
  uir_tuple: tuple, required
      Tuple of 3 numpy arrays (user_indices, item_indices, rating_values).
  
  timestamps: numpy.array, optional, default: None
      Array of timestamps corresponding to observations in `uir_tuple`.
  
  seed: int, optional, default: None
      Random seed for reproducing data sampling.
  
  Attributes
  ----------
  num_ratings: int
      Number of rating observations in the dataset.
  
  max_rating: float
      Maximum value among the rating observations.
  
  min_rating: float
      Minimum value among the rating observations.
  
  global_mean: float
      Average value over the rating observations.
  
  uir_tuple: tuple
      Tuple three numpy arrays (user_indices, item_indices, rating_values).
  
  timestamps: numpy.array
      Numpy array of timestamps corresponding to feedback in `uir_tuple`.
      This is only available when input data is in `UIRT` format.
class_docstr_tok: ["Training","set","contains","preference","matrix","Parameters","--","--","--","--","--","num_users",":","int",",","required","Number","of","users",".","num_items",":","int",",","required","Number","of","items",".","uid_map",":",":","obj",":","`","OrderDict","`",",","required","The","dictionary","containing","mapping","from","user","original","ids","to","mapped","integer","indices",".","iid_map",":",":","obj",":","`","OrderDict","`",",","required","The","dictionary","containing","mapping","from","item","original","ids","to","mapped","integer","indices",".","uir_tuple",":","tuple",",","required","Tuple","of","3","numpy","arrays","(","user_indices",",","item_indices",",","rating_values",")",".","timestamps",":","numpy.array",",","optional",",","default",":","None","Array","of","timestamps","corresponding","to","observations","in","`","uir_tuple","`",".","seed",":","int",",","optional",",","default",":","None","Random","seed","for","reproducing","data","sampling",".","Attributes","--","--","--","--","--","num_ratings",":","int","Number","of","rating","observations","in","the","dataset",".","max_rating",":","float","Maximum","value","among","the","rating","observations",".","min_rating",":","float","Minimum","value","among","the","rating","observations",".","global_mean",":","float","Average","value","over","the","rating","observations",".","uir_tuple",":","tuple","Tuple","three","numpy","arrays","(","user_indices",",","item_indices",",","rating_values",")",".","timestamps",":","numpy.array","Numpy","array","of","timestamps","corresponding","to","feedback","in","`","uir_tuple","`",".","This","is","only","available","when","input","data","is","in","`","UIRT","`","format","."]
docstr: Data organized by user sorted chronologically (timestamps required).
  A dictionary where keys are users, values are tuples of three chronologically
  sorted lists (items, ratings, timestamps) interacted by the corresponding users.
docstr_tok: ["Data","organized","by","user","sorted","chronologically","(","timestamps","required",")",".","A","dictionary","where","keys","are","users",",","values","are","tuples","of","three","chronologically","sorted","lists","(","items",",","ratings",",","timestamps",")","interacted","by","the","corresponding","users","."]
code: def chrono_user_data(self):
      """Data organized by user sorted chronologically (timestamps required).
      A dictionary where keys are users, values are tuples of three chronologically
      sorted lists (items, ratings, timestamps) interacted by the corresponding users.
      """
      if self.timestamps is None:
          raise ValueError("Timestamps are required but None!")
  
      if self.__chrono_user_data is None:
          self.__chrono_user_data = defaultdict()
          for u, i, r, t in zip(*self.uir_tuple, self.timestamps):
              u_data = self.__chrono_user_data.setdefault(
                  u, ([], [], [])
              )
              u_data[0].append(i)
              u_data[1].append(r)
              u_data[2].append(t)
          # sorting based on timestamps
          for user, (
              items,
              ratings,
              timestamps,
          ) in self.__chrono_user_data.items():
              sorted_idx = np.argsort(timestamps)
              sorted_items = [items[i] for i in sorted_idx]
              sorted_ratings = [ratings[i] for i in sorted_idx]
              sorted_timestamps = [timestamps[i] for i in sorted_idx]
              self.__chrono_user_data[user] = (
                  sorted_items,
                  sorted_ratings,
                  sorted_timestamps,
              )
      return self.__chrono_user_data
  
imports: import copy
  import os
  import pickle
  import warnings
  from collections import Counter, OrderedDict, defaultdict
  import numpy
  from scipy.sparse import csc_matrix, csr_matrix, dok_matrix
  from ..utils import estimate_batches, get_rng, validate_format
label_desc: Use image node_id 6 for calling the Dataset obj's underlying member method code with example usage: obj.chrono_user_data() and returns: self