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","."]
code: def __init__(
      self,
      sample_function,
      batch_size,
      ids,
      targets=None,
      shuffle=True,
      seed=None,
  ):
      # Check that ids is an iterable
      if not is_real_iterable(ids):
          raise TypeError(
              "IDs must be an iterable or numpy array of graph node IDs"
          )
  
      # Check targets is iterable & has the correct length
      if targets is not None:
          if not is_real_iterable(targets):
              raise TypeError(
                  "Targets must be None or an iterable or numpy array "
              )
          if len(ids) != len(targets):
              raise ValueError(
                  "The length of the targets must be the same as the length of the ids"
              )
          self.targets = np.asanyarray(targets)
      else:
          self.targets = None
  
      # Store the generator to draw samples from graph
      if isinstance(sample_function, collections.abc.Callable):
          self._sample_function = sample_function
      else:
          raise TypeError(
              "({}) The sampling function expects a callable function.".format(
                  type(self).__name__
              )
          )
  
      self.ids = list(ids)
      self.data_size = len(self.ids)
      self.shuffle = shuffle
      self.batch_size = batch_size
      self._rs, _ = random_state(seed)
  
      # Shuffle IDs to start
      self.on_epoch_end()
  
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 1 to create a new NodeSequence object from inherited base classes: Sequence with example: obj = NodeSequence(sample_function, batch_size, ids, targets, shuffle, seed)