class_docstr: Negative Log-Likelihood loss.
  
  As described in :cite:`trouillon2016complex`.
  
  .. math::
  
      \mathcal{L}(\Theta) = \sum_{t \in \mathcal{G} \cup \mathcal{C}}log(1 + exp(-y \, f_{model}(t;\Theta)))
  
  where :math:`y \in \{-1, 1\}` is the label of the statement, :math:`\mathcal{G}` is the set of positives,
  :math:`\mathcal{C}` is the set of corruptions and :math:`f_{model}(t;\Theta)` is the model-specific scoring function.
  
  Example
  -------
  >>> import ampligraph.latent_features.loss_functions as lfs
  >>> loss = lfs.NLLLoss({'reduction': 'mean'})
  >>> isinstance(loss, lfs.NLLLoss)
  True
  
  >>> loss = lfs.get('nll')
  >>> isinstance(loss, lfs.NLLLoss)
  True
class_docstr_tok: ["Negative","Log-Likelihood","loss",".","As","described","in",":","cite",":","`","trouillon2016complex","`",".","..","math",":",":","\\mathcal","{","L","}","(","\\Theta",")","=","\\sum_","{","t","\\in","\\mathcal","{","G","}","\\cup","\\mathcal","{","C","}","}","log","(","1","+","exp","(","-y","\\",",","f_","{","model","}","(","t",";","\\Theta",")",")",")","where",":","math",":","`","y","\\in","\\","{","-1",",","1\\","}","`","is","the","label","of","the","statement",",",":","math",":","`","\\mathcal","{","G","}","`","is","the","set","of","positives",",",":","math",":","`","\\mathcal","{","C","}","`","is","the","set","of","corruptions","and",":","math",":","`","f_","{","model","}","(","t",";","\\Theta",")","`","is","the","model-specific","scoring","function",".","Example","--","--","--","-",">",">",">","import","ampligraph.latent_features.loss_functions","as","lfs",">",">",">","loss","=","lfs.NLLLoss","(","{","'reduction","'",":","'mean","'","}",")",">",">",">","isinstance","(","loss",",","lfs.NLLLoss",")","True",">",">",">","loss","=","lfs.get","(","'nll","'",")",">",">",">","isinstance","(","loss",",","lfs.NLLLoss",")","True"]
docstr: Apply the loss function.
  
  Parameters
  ----------
  scores_pos : tf.Tensor, shape (n, 1)
      A tensor of scores assigned to positive statements.
  scores_neg : tf.Tensor, shape (n, 1)
      A tensor of scores assigned to negative statements.
  
  Returns
  -------
  loss : tf.Tensor
      The loss value that must be minimized.
docstr_tok: ["Apply","the","loss","function",".","Parameters","--","--","--","--","--","scores_pos",":","tf.Tensor",",","shape","(","n",",","1",")","A","tensor","of","scores","assigned","to","positive","statements",".","scores_neg",":","tf.Tensor",",","shape","(","n",",","1",")","A","tensor","of","scores","assigned","to","negative","statements",".","Returns","--","--","--","-","loss",":","tf.Tensor","The","loss","value","that","must","be","minimized","."]
code: def _apply_loss(self, scores_pos, scores_neg):
      """Apply the loss function.
  
      Parameters
      ----------
      scores_pos : tf.Tensor, shape (n, 1)
          A tensor of scores assigned to positive statements.
      scores_neg : tf.Tensor, shape (n, 1)
          A tensor of scores assigned to negative statements.
  
      Returns
      -------
      loss : tf.Tensor
          The loss value that must be minimized.
  
      """
      scores_neg = clip_before_exp(scores_neg)
      scores_pos = clip_before_exp(scores_pos)
  
      scores_pos = self._broadcast_score_pos(
          scores_pos, scores_neg.shape[0]
      )
  
      scores = tf.concat([-scores_pos, scores_neg], 0)
      return self._reduce_sample_loss(tf.math.log(1 + tf.exp(scores)))
  
imports: import abc
  import logging
  import six
  import tensorflow
  from tensorflow.python.keras import metrics
  from tensorflow.python.keras.utils import losses_utils
  from tensorflow.python.ops import math_ops
label_desc: Use image node_id 3 for calling the NLLLoss obj's underlying member method code with example usage: obj._apply_loss(scores_pos, scores_neg) and returns: self