class_docstr: Keras-compatible data generator to use with Keras methods :meth:`keras.Model.fit`,
  :meth:`keras.Model.evaluate`, and :meth:`keras.Model.predict`
  This class generates data samples for link inference models
  and should be created using the :meth:`flow` method of
  :class:`.GraphSAGELinkGenerator` or :class:`.HinSAGELinkGenerator` or :class:`.Attri2VecLinkGenerator`.
  
  Args:
      sample_function (Callable): A function that returns features for supplied head nodes.
      ids (iterable): Link IDs to batch, each link id being a tuple of (src, dst) node ids.
      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.
      seed (int, optional): Random seed
class_docstr_tok: ["Keras-compatible","data","generator","to","use","with","Keras","methods",":","meth",":","`","keras.Model.fit","`",",",":","meth",":","`","keras.Model.evaluate","`",",","and",":","meth",":","`","keras.Model.predict","`","This","class","generates","data","samples","for","link","inference","models","and","should","be","created","using","the",":","meth",":","`","flow","`","method","of",":","class",":","`",".GraphSAGELinkGenerator","`","or",":","class",":","`",".HinSAGELinkGenerator","`","or",":","class",":","`",".Attri2VecLinkGenerator","`",".","Args",":","sample_function","(","Callable",")",":","A","function","that","returns","features","for","supplied","head","nodes",".","ids","(","iterable",")",":","Link","IDs","to","batch",",","each","link","id","being","a","tuple","of","(","src",",","dst",")","node","ids",".","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",".","seed","(","int",",","optional",")",":","Random","seed"]
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(self.name, batch_num, start_idx))
  
      # The ID indices for this batch
      batch_indices = self.indices[start_idx:end_idx]
  
      # Get head (root) nodes for links
      head_ids = [self.ids[ii] for ii in batch_indices]
  
      # Get targets for nodes
      batch_targets = (
          None if self.targets is None else self.targets[batch_indices]
      )
  
      # Get node features for batch of link ids
      batch_feats = self._sample_features(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 LinkSequence obj's underlying member method code with example usage: obj.__getitem__(batch_num) and returns: batch_feats,  batch_targets