class_docstr: Keras-compatible data generator to use with the Keras
  methods :meth:`keras.Model.fit`, :meth:`keras.Model.evaluate`,
  and :meth:`keras.Model.predict`.
  
  This class generated data samples for node inference models
  and should be created using the `.flow(...)` method of
  :class:`.GraphSAGENodeGenerator` or :class:`.DirectedGraphSAGENodeGenerator`
  or :class:`.HinSAGENodeGenerator` or :class:`.Attri2VecNodeGenerator`.
  
  These generator classes are used within the NodeSequence to generate
  the required features for downstream ML tasks from the graph.
  
  Args:
      sample_function (Callable): A function that returns features for supplied head nodes.
      ids (list): A list of the node_ids to be used as head-nodes in the downstream task.
      targets (list, optional): A list of targets or labels to be used in the downstream task.
      shuffle (bool): If True (default) the ids will be randomly shuffled every epoch.
class_docstr_tok: ["Keras-compatible","data","generator","to","use","with","the","Keras","methods",":","meth",":","`","keras.Model.fit","`",",",":","meth",":","`","keras.Model.evaluate","`",",","and",":","meth",":","`","keras.Model.predict","`",".","This","class","generated","data","samples","for","node","inference","models","and","should","be","created","using","the","`",".flow","(","...",")","`","method","of",":","class",":","`",".GraphSAGENodeGenerator","`","or",":","class",":","`",".DirectedGraphSAGENodeGenerator","`","or",":","class",":","`",".HinSAGENodeGenerator","`","or",":","class",":","`",".Attri2VecNodeGenerator","`",".","These","generator","classes","are","used","within","the","NodeSequence","to","generate","the","required","features","for","downstream","ML","tasks","from","the","graph",".","Args",":","sample_function","(","Callable",")",":","A","function","that","returns","features","for","supplied","head","nodes",".","ids","(","list",")",":","A","list","of","the","node_ids","to","be","used","as","head-nodes","in","the","downstream","task",".","targets","(","list",",","optional",")",":","A","list","of","targets","or","labels","to","be","used","in","the","downstream","task",".","shuffle","(","bool",")",":","If","True","(","default",")","the","ids","will","be","randomly","shuffled","every","epoch","."]
docstr: Generate one batch of data
  
  Args:
      batch_num (int): number of a batch
  
  Returns:
      batch_feats (list): Node features for nodes and neighbours sampled from a
          batch of the supplied IDs
      batch_targets (list): Targets/labels for the batch.
docstr_tok: ["Generate","one","batch","of","data","Args",":","batch_num","(","int",")",":","number","of","a","batch","Returns",":","batch_feats","(","list",")",":","Node","features","for","nodes","and","neighbours","sampled","from","a","batch","of","the","supplied","IDs","batch_targets","(","list",")",":","Targets\/labels","for","the","batch","."]
code: def __getitem__(self, batch_num):
      """
      Generate one batch of data
  
      Args:
          batch_num (int): number of a batch
  
      Returns:
          batch_feats (list): Node features for nodes and neighbours sampled from a
              batch of the supplied IDs
          batch_targets (list): Targets/labels for the batch.
  
      """
      start_idx = self.batch_size * batch_num
      end_idx = start_idx + self.batch_size
      if start_idx >= self.data_size:
          raise IndexError(
              "Mapper: batch_num larger than length of data"
          )
      # print("Fetching batch {} [{}]".format(batch_num, start_idx))
  
      # The ID indices for this batch
      batch_indices = self.indices[start_idx:end_idx]
  
      # Get head (root) nodes
      head_ids = [self.ids[ii] for ii in batch_indices]
  
      # Get corresponding targets
      batch_targets = (
          None if self.targets is None else self.targets[batch_indices]
      )
  
      # Get features for nodes
      batch_feats = self._sample_function(head_ids, batch_num)
  
      return batch_feats, batch_targets
  
imports: import warnings
  import operator
  import random
  import collections
  import numpy
  import itertools
  import networkx
  import scipy.sparse
  from tensorflow.keras import backend
  from functools import reduce
  from tensorflow.keras.utils import Sequence
  from ..data.unsupervised_sampler import UnsupervisedSampler
  from ..core.utils import is_real_iterable
  from ..random import random_state
  from scipy import sparse
  from ..core.experimental import experimental
label_desc: Use image node_id 3 for calling the NodeSequence obj's underlying member method code with example usage: obj.__getitem__(batch_num) and returns: batch_feats,  batch_targets