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: Create an iterator over data yielding batch of users, items, and rating values
  
  Parameters
  ----------
  batch_size: int, optional, default = 1
  
  shuffle: bool, optional, default: False
      If `True`, orders of triplets will be randomized. If `False`, default orders kept.
  
  binary: bool, optional, default: False
      If `True`, non-zero ratings will be turned into `1`, otherwise, values remain unchanged.
  
  num_zeros: int, optional, default = 0
      Number of unobserved ratings (zeros) to be added per user. This could be used
      for negative sampling. By default, no values are added.
  
  Returns
  -------
  iterator : batch of users (array of 'int'), batch of items (array of 'int'),
      batch of ratings (array of 'float')
docstr_tok: ["Create","an","iterator","over","data","yielding","batch","of","users",",","items",",","and","rating","values","Parameters","--","--","--","--","--","batch_size",":","int",",","optional",",","default","=","1","shuffle",":","bool",",","optional",",","default",":","False","If","`","True","`",",","orders","of","triplets","will","be","randomized",".","If","`","False","`",",","default","orders","kept",".","binary",":","bool",",","optional",",","default",":","False","If","`","True","`",",","non-zero","ratings","will","be","turned","into","`","1","`",",","otherwise",",","values","remain","unchanged",".","num_zeros",":","int",",","optional",",","default","=","0","Number","of","unobserved","ratings","(","zeros",")","to","be","added","per","user",".","This","could","be","used","for","negative","sampling",".","By","default",",","no","values","are","added",".","Returns","--","--","--","-","iterator",":","batch","of","users","(","array","of","'int","'",")",",","batch","of","items","(","array","of","'int","'",")",",","batch","of","ratings","(","array","of","'float","'",")"]
code: def uir_iter(
      self, batch_size=1, shuffle=False, binary=False, num_zeros=0
  ):
      """Create an iterator over data yielding batch of users, items, and rating values
  
      Parameters
      ----------
      batch_size: int, optional, default = 1
  
      shuffle: bool, optional, default: False
          If `True`, orders of triplets will be randomized. If `False`, default orders kept.
  
      binary: bool, optional, default: False
          If `True`, non-zero ratings will be turned into `1`, otherwise, values remain unchanged.
  
      num_zeros: int, optional, default = 0
          Number of unobserved ratings (zeros) to be added per user. This could be used
          for negative sampling. By default, no values are added.
  
      Returns
      -------
      iterator : batch of users (array of 'int'), batch of items (array of 'int'),
          batch of ratings (array of 'float')
  
      """
      for batch_ids in self.idx_iter(
          len(self.uir_tuple[0]), batch_size, shuffle
      ):
          batch_users = self.uir_tuple[0][batch_ids]
          batch_items = self.uir_tuple[1][batch_ids]
          if binary:
              batch_ratings = np.ones_like(batch_items)
          else:
              batch_ratings = self.uir_tuple[2][batch_ids]
  
          if num_zeros > 0:
              repeated_users = batch_users.repeat(num_zeros)
              neg_items = np.empty_like(repeated_users)
              for i, u in enumerate(repeated_users):
                  j = self.rng.randint(0, self.num_items)
                  while self.dok_matrix[u, j] > 0:
                      j = self.rng.randint(0, self.num_items)
                  neg_items[i] = j
              batch_users = np.concatenate(
                  (batch_users, repeated_users)
              )
              batch_items = np.concatenate((batch_items, neg_items))
              batch_ratings = np.concatenate(
                  (batch_ratings, np.zeros_like(neg_items))
              )
  
          yield batch_users, batch_items, batch_ratings
  
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 20 for calling the Dataset obj's underlying member method code with example usage: obj.uir_iter(batch_size, shuffle, binary, num_zeros) without return types