class_docstr: A class representing a training dataset for KB.
  Dataset.dataset is a tf.data.Dataset object and Dataset.iterator is an
  iterator over the dataset.
  Dataset.input_tensors are the input tensors used in downstream model, it
  can be returned by Dataset.get_input_tensors()
  Dataset iteration parameters are:
  batchsize: size of each mini-batch
  num_epochs: number of epochs to iterate over the dataset
  
  Each tuple is processed to include the neighborhoods of the entities using
  the following parameters:
  max_neighbors: maximum number of entities in the neighborhood, if None this
  is specified from train_graph
  max_negatives: maximum  number of negative entities samples for each example
class_docstr_tok: ["A","class","representing","a","training","dataset","for","KB",".","Dataset.dataset","is","a","tf.data.Dataset","object","and","Dataset.iterator","is","an","iterator","over","the","dataset",".","Dataset.input_tensors","are","the","input","tensors","used","in","downstream","model",",","it","can","be","returned","by","Dataset.get_input_tensors","(",")","Dataset","iteration","parameters","are",":","batchsize",":","size","of","each","mini-batch","num_epochs",":","number","of","epochs","to","iterate","over","the","dataset","Each","tuple","is","processed","to","include","the","neighborhoods","of","the","entities","using","the","following","parameters",":","max_neighbors",":","maximum","number","of","entities","in","the","neighborhood",",","if","None","this","is","specified","from","train_graph","max_negatives",":","maximum","number","of","negative","entities","samples","for","each","example"]
docstr: Initialize the Dataset object.
docstr_tok: ["Initialize","the","Dataset","object","."]
code: def __init__(
      self,
      data_graph,
      train_graph=None,
      mode="train",
      max_negatives=2,
      max_neighbors=None,
      num_epochs=20,
      batchsize=64,
      model_type="attention",
      max_text_len=None,
      max_text_neighbors=None,
      val_graph=None,
  ):
      """Initialize the Dataset object."""
      if not train_graph:
          train_graph = data_graph
      self.train_graph = train_graph
      self.data_graph = data_graph
      self.mode = mode
      if mode != "train":
          if max_negatives:
              self.max_negatives = max_negatives
          else:
              self.max_negatives = train_graph.ent_vocab_size - 1
      else:
          if not max_negatives and mode == "train":
              raise ValueError(
                  "Must provide max_negatives value for training."
              )
          self.max_negatives = max_negatives
      if max_neighbors:
          self.max_neighbors = max_neighbors
      else:
          self.max_neighbors = train_graph.max_neighbors
      self.num_epochs = num_epochs
      self.batchsize = batchsize
      self.iterator = None
      self.input_tensors = None
      self.output_shapes = None
      self.model_type = model_type
      self.max_text_len = max_text_len
      self.max_text_neighbors = max_text_neighbors
      self.val_graph = val_graph
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import clueweb_text_graph
  import numpy
  import tensorflow
label_desc: Use image node_id 1 to create a new Dataset object from inherited base classes: object with example: obj = Dataset(data_graph, train_graph, mode, max_negatives, max_neighbors, num_epochs, batchsize, model_type, max_text_len, max_text_neighbors, val_graph)