docstr: Basic class that applies skip-gram-like loss
  (i.e., dot product of node+target and node and negative samples)
  Args:
      bilinear_weights: use a bilinear weight for affinity calculation: u^T A v. If set to
          false, it is assumed that input dimensions are the same and the affinity will be 
          based on dot product.
docstr_tok: ["Basic","class","that","applies","skip-gram-like","loss","(","i.e.",",","dot","product","of","node+target","and","node","and","negative","samples",")","Args",":","bilinear_weights",":","use","a","bilinear","weight","for","affinity","calculation",":","u^T","A","v.","If","set","to","false",",","it","is","assumed","that","input","dimensions","are","the","same","and","the","affinity","will","be","based","on","dot","product","."]
code: def __init__(
      self,
      input_dim1,
      input_dim2,
      placeholders,
      dropout=False,
      act=tf.nn.sigmoid,
      loss_fn="xent",
      neg_sample_weights=1.0,
      bias=False,
      bilinear_weights=False,
      **kwargs,
  ):
      """
      Basic class that applies skip-gram-like loss
      (i.e., dot product of node+target and node and negative samples)
      Args:
          bilinear_weights: use a bilinear weight for affinity calculation: u^T A v. If set to
              false, it is assumed that input dimensions are the same and the affinity will be
              based on dot product.
      """
      super(BipartiteEdgePredLayer, self).__init__(**kwargs)
      self.input_dim1 = input_dim1
      self.input_dim2 = input_dim2
      self.act = act
      self.bias = bias
      self.eps = 1e-7
  
      # Margin for hinge loss
      self.margin = 0.1
      self.neg_sample_weights = neg_sample_weights
  
      self.bilinear_weights = bilinear_weights
  
      if dropout:
          self.dropout = placeholders["dropout"]
      else:
          self.dropout = 0.0
  
      # output a likelihood term
      self.output_dim = 1
      with tf.variable_scope(self.name + "_vars"):
          # bilinear form
          if bilinear_weights:
              # self.vars['weights'] = glorot([input_dim1, input_dim2],
              #                              name='pred_weights')
              self.vars["weights"] = tf.get_variable(
                  "pred_weights",
                  shape=(input_dim1, input_dim2),
                  dtype=tf.float32,
                  initializer=tf.contrib.layers.xavier_initializer(),
              )
  
          if self.bias:
              self.vars["bias"] = zeros([self.output_dim], name="bias")
  
      if loss_fn == "xent":
          self.loss_fn = self._xent_loss
      elif loss_fn == "skipgram":
          self.loss_fn = self._skipgram_loss
      elif loss_fn == "hinge":
          self.loss_fn = self._hinge_loss
  
      if self.logging:
          self._log_vars()
  
file_path: GraphSAGE/graphsage/prediction.py
imports: from __future__ import division
  from __future__ import print_function
  from graphsage.inits import zeros
  from graphsage.layers import Layer
  import tensorflow
label_desc: Use image node_id 1 to create a new BipartiteEdgePredLayer object from inherited base classes: Layer with example: obj = BipartiteEdgePredLayer(input_dim1, input_dim2, placeholders, dropout, act, loss_fn, neg_sample_weights, bias, bilinear_weights)