class_docstr: Base implementation of unsupervised GraphSAGE
class_docstr_tok: ["Base","implementation","of","unsupervised","GraphSAGE"]
docstr: Args:
      - placeholders: Stanford TensorFlow placeholder object.
      - features: Numpy array with node features. 
                  NOTE: Pass a None object to train in featureless mode (identity features for nodes)!
      - adj: Numpy array with adjacency lists (padded with random re-samples)
      - degrees: Numpy array with node degrees. 
      - layer_infos: List of SAGEInfo namedtuples that describe the parameters of all 
             the recursive layers. See SAGEInfo definition above.
      - concat: whether to concatenate during recursive iterations
      - aggregator_type: how to aggregate neighbor information
      - model_size: one of "small" and "big"
      - identity_dim: Set to positive int to use identity features (slow and cannot generalize, but better accuracy)
docstr_tok: ["Args",":","-","placeholders",":","Stanford","TensorFlow","placeholder","object",".","-","features",":","Numpy","array","with","node","features",".","NOTE",":","Pass","a","None","object","to","train","in","featureless","mode","(","identity","features","for","nodes",")","!","-","adj",":","Numpy","array","with","adjacency","lists","(","padded","with","random","re-samples",")","-","degrees",":","Numpy","array","with","node","degrees",".","-","layer_infos",":","List","of","SAGEInfo","namedtuples","that","describe","the","parameters","of","all","the","recursive","layers",".","See","SAGEInfo","definition","above",".","-","concat",":","whether","to","concatenate","during","recursive","iterations","-","aggregator_type",":","how","to","aggregate","neighbor","information","-","model_size",":","one","of","``","small","''","and","``","big","''","-","identity_dim",":","Set","to","positive","int","to","use","identity","features","(","slow","and","can","not","generalize",",","but","better","accuracy",")"]
code: def __init__(
      self,
      placeholders,
      features,
      adj,
      degrees,
      layer_infos,
      concat=True,
      aggregator_type="mean",
      model_size="small",
      identity_dim=0,
      **kwargs,
  ):
      """
      Args:
          - placeholders: Stanford TensorFlow placeholder object.
          - features: Numpy array with node features.
                      NOTE: Pass a None object to train in featureless mode (identity features for nodes)!
          - adj: Numpy array with adjacency lists (padded with random re-samples)
          - degrees: Numpy array with node degrees.
          - layer_infos: List of SAGEInfo namedtuples that describe the parameters of all
                 the recursive layers. See SAGEInfo definition above.
          - concat: whether to concatenate during recursive iterations
          - aggregator_type: how to aggregate neighbor information
          - model_size: one of "small" and "big"
          - identity_dim: Set to positive int to use identity features (slow and cannot generalize, but better accuracy)
      """
      super(SampleAndAggregate, self).__init__(**kwargs)
      if aggregator_type == "mean":
          self.aggregator_cls = MeanAggregator
      elif aggregator_type == "seq":
          self.aggregator_cls = SeqAggregator
      elif aggregator_type == "maxpool":
          self.aggregator_cls = MaxPoolingAggregator
      elif aggregator_type == "meanpool":
          self.aggregator_cls = MeanPoolingAggregator
      elif aggregator_type == "gcn":
          self.aggregator_cls = GCNAggregator
      else:
          raise Exception("Unknown aggregator: ", self.aggregator_cls)
  
      # get info from placeholders...
      self.inputs1 = placeholders["batch1"]
      self.inputs2 = placeholders["batch2"]
      self.model_size = model_size
      self.adj_info = adj
      if identity_dim > 0:
          self.embeds = tf.get_variable(
              "node_embeddings",
              [adj.get_shape().as_list()[0], identity_dim],
          )
      else:
          self.embeds = None
      if features is None:
          if identity_dim == 0:
              raise Exception(
                  "Must have a positive value for identity feature dimension if no input features given."
              )
          self.features = self.embeds
      else:
          self.features = tf.Variable(
              tf.constant(features, dtype=tf.float32), trainable=False
          )
          if not self.embeds is None:
              self.features = tf.concat(
                  [self.embeds, self.features], axis=1
              )
      self.degrees = degrees
      self.concat = concat
  
      self.dims = [
          (0 if features is None else features.shape[1]) + identity_dim
      ]
      self.dims.extend(
          [layer_infos[i].output_dim for i in range(len(layer_infos))]
      )
      self.batch_size = placeholders["batch_size"]
      self.placeholders = placeholders
      self.layer_infos = layer_infos
  
      self.optimizer = tf.train.AdamOptimizer(
          learning_rate=FLAGS.learning_rate
      )
  
      self.build()
  
imports: from collections import namedtuple
  import tensorflow
  import math
  import graphsage.layers
  import graphsage.metrics
  from .prediction import BipartiteEdgePredLayer
  from .aggregators import MeanAggregator, MaxPoolingAggregator, MeanPoolingAggregator, SeqAggregator, GCNAggregator
label_desc: Use image node_id 1 to create a new SampleAndAggregate object from inherited base classes: GeneralizedModel with example: obj = SampleAndAggregate(placeholders, features, adj, degrees, layer_infos, concat, aggregator_type, model_size, identity_dim)