class_docstr: Training set contains history baskets
  
  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).
  
  basket_indices: numpy.array, required
      Array of basket indices corresponding to observation in `uir_tuple`.
  
  timestamps: numpy.array, optional, default: None
      Numpy array of timestamps corresponding to feedback in `uir_tuple`.
      This is only available when input data is in `UBIT` and `UBITJson` formats.
  
  extra_data: numpy.array, optional, default: None
      Array of json object corresponding to observations in `uir_tuple`.
  
  seed: int, optional, default: None
      Random seed for reproducing data sampling.
  
  Attributes
  ----------
  ubi_tuple: tuple
      Tuple (user_indices, baskets).
  
  timestamps: numpy.array
      Numpy array of timestamps corresponding to feedback in `ubi_tuple`.
      This is only available when input data is in `UTB` format.
class_docstr_tok: ["Training","set","contains","history","baskets","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",")",".","basket_indices",":","numpy.array",",","required","Array","of","basket","indices","corresponding","to","observation","in","`","uir_tuple","`",".","timestamps",":","numpy.array",",","optional",",","default",":","None","Numpy","array","of","timestamps","corresponding","to","feedback","in","`","uir_tuple","`",".","This","is","only","available","when","input","data","is","in","`","UBIT","`","and","`","UBITJson","`","formats",".","extra_data",":","numpy.array",",","optional",",","default",":","None","Array","of","json","object","corresponding","to","observations","in","`","uir_tuple","`",".","seed",":","int",",","optional",",","default",":","None","Random","seed","for","reproducing","data","sampling",".","Attributes","--","--","--","--","--","ubi_tuple",":","tuple","Tuple","(","user_indices",",","baskets",")",".","timestamps",":","numpy.array","Numpy","array","of","timestamps","corresponding","to","feedback","in","`","ubi_tuple","`",".","This","is","only","available","when","input","data","is","in","`","UTB","`","format","."]
docstr: Constructing Dataset from UBIT format (User, Basket, Item, Timestamp)
  
  Parameters
  ----------
  data: tuple
      Data in the form of quadruples (user, basket, item, timestamp)
  
  seed: int, optional, default: None
      Random seed for reproducing data sampling.
  
  Returns
  -------
  res: :obj:`<cornac.data.BasketDataset>`
      BasketDataset object.
docstr_tok: ["Constructing","Dataset","from","UBIT","format","(","User",",","Basket",",","Item",",","Timestamp",")","Parameters","--","--","--","--","--","data",":","tuple","Data","in","the","form","of","quadruples","(","user",",","basket",",","item",",","timestamp",")","seed",":","int",",","optional",",","default",":","None","Random","seed","for","reproducing","data","sampling",".","Returns","--","--","--","-","res",":",":","obj",":","`","<","cornac.data.BasketDataset",">","`","BasketDataset","object","."]
code: def from_ubit(cls, data, seed=None):
      """Constructing Dataset from UBIT format (User, Basket, Item, Timestamp)
  
      Parameters
      ----------
      data: tuple
          Data in the form of quadruples (user, basket, item, timestamp)
  
      seed: int, optional, default: None
          Random seed for reproducing data sampling.
  
      Returns
      -------
      res: :obj:`<cornac.data.BasketDataset>`
          BasketDataset object.
  
      """
      return cls.build(data, fmt="UBIT", seed=seed)
  
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 8 for calling the BasketDataset obj's underlying member method code with example usage: obj.from_ubit(cls, data, seed) and returns: cls