class_docstr: Translating Embeddings (TransE) scoring layer.
  
  The model as described in :cite:`bordes2013translating`.
  
  The scoring function of TransE computes a similarity between the embedding of the subject
  :math:`\mathbf{e}_{sub}` translated by the embedding of the predicate :math:`\mathbf{e}_{pred}`,
  and the embedding of the object :math:`\mathbf{e}_{obj}`,
  using the :math:`L_1` or :math:`L_2` norm :math:`||\cdot||` (default: :math:`L_1`):
  
  .. math::
      f_{TransE}=-||\mathbf{e}_{sub} + \mathbf{e}_{pred} - \mathbf{e}_{obj}||
  
  Such scoring function is then used on positive and negative triples :math:`t^+, t^-` in the loss function.
docstr: Compute subject corruption scores.
  
  Evaluate the inputs against subject corruptions and scores of the corruptions.
  
  Parameters
  ----------
  triples: array-like, shape (n, k)
      Batch of input embeddings.
  ent_matrix: array-like, shape (m, k)
      Slice of embedding matrix (corruptions).
  
  Returns
  -------
  scores: tf.Tensor, shape (n, 1)
      Scores of subject corruptions (corruptions defined by `ent_embs` matrix).
code: def _get_subject_corruption_scores(self, triples, ent_matrix):
      """Compute subject corruption scores.
  
      Evaluate the inputs against subject corruptions and scores of the corruptions.
  
      Parameters
      ----------
      triples: array-like, shape (n, k)
          Batch of input embeddings.
      ent_matrix: array-like, shape (m, k)
          Slice of embedding matrix (corruptions).
  
      Returns
      -------
      scores: tf.Tensor, shape (n, 1)
          Scores of subject corruptions (corruptions defined by `ent_embs` matrix).
      """
      # get the subject, predicate and object embeddings of True positives
      rel_emb, obj_emb = triples[1], triples[2]
      # compute the score by broadcasting the corruption embeddings(ent_matrix) and using the scoring function
      # compute scores as -|| s_corr + p - o||
      sub_corr_score = tf.negative(
          tf.norm(
              ent_matrix + tf.expand_dims(rel_emb - obj_emb, 1),
              axis=2,
              ord=1,
          )
      )
      return sub_corr_score
  
file_path: AmpliGraph/ampligraph/latent_features/layers/scoring/TransE.py
imports: import tensorflow
  from .AbstractScoringLayer import register_layer, AbstractScoringLayer
label_desc: Use image node_id 4 for calling the TransE obj's underlying member method code with example usage: obj._get_subject_corruption_scores(triples, ent_matrix) and returns: sub_corr_score