class_docstr: Multiclass Negative Log-Likelihood loss.
  
  Introduced in :cite:`chen2015`, this loss can be used when both the subject and objects are corrupted
  (to use it, pass ``corrupt_sides=['s,o']`` in the embedding model parameters).
  
  This loss was re-engineered in :cite:`kadlecBK17` where only the object was corrupted to get improved
  performance (to use it in this way pass ``corrupt_sides ='o'`` in the embedding model parameters).
  
  .. math::
  
      \mathcal{L(X)} = -\sum_{x_{e_1,e_2,r_k} \in X} log\,p(e_2|e_1,r_k)
       -\sum_{x_{e_1,e_2,r_k} \in X} log\,p(e_1|r_k, e_2)
  
  Example
  -------
  >>> import ampligraph.latent_features.loss_functions as lfs
  >>> loss = lfs.NLLMulticlass({'reduction': 'mean'})
  >>> isinstance(loss, lfs.NLLMulticlass)
  True
  
  >>> loss = lfs.get('multiclass_nll')
  >>> isinstance(loss, lfs.NLLMulticlass)
  True
class_docstr_tok: ["Multiclass","Negative","Log-Likelihood","loss",".","Introduced","in",":","cite",":","`","chen2015","`",",","this","loss","can","be","used","when","both","the","subject","and","objects","are","corrupted","(","to","use","it",",","pass","``","corrupt_sides=","[","'s",",","o","'","]","``","in","the","embedding","model","parameters",")",".","This","loss","was","re-engineered","in",":","cite",":","`","kadlecBK17","`","where","only","the","object","was","corrupted","to","get","improved","performance","(","to","use","it","in","this","way","pass","``","corrupt_sides","=","'","o","'","``","in","the","embedding","model","parameters",")",".","..","math",":",":","\\mathcal","{","L","(","X",")","}","=","-\\sum_","{","x_","{","e_1",",","e_2",",","r_k","}","\\in","X","}","log\\",",","p","(","e_2|e_1",",","r_k",")","-\\sum_","{","x_","{","e_1",",","e_2",",","r_k","}","\\in","X","}","log\\",",","p","(","e_1|r_k",",","e_2",")","Example","--","--","--","-",">",">",">","import","ampligraph.latent_features.loss_functions","as","lfs",">",">",">","loss","=","lfs.NLLMulticlass","(","{","'reduction","'",":","'mean","'","}",")",">",">",">","isinstance","(","loss",",","lfs.NLLMulticlass",")","True",">",">",">","loss","=","lfs.get","(","'multiclass_nll","'",")",">",">",">","isinstance","(","loss",",","lfs.NLLMulticlass",")","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 (eta, n)
      A tensor of scores assigned to negative statements.
  
  Returns
  -------
  loss : float
      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","(","eta",",","n",")","A","tensor","of","scores","assigned","to","negative","statements",".","Returns","--","--","--","-","loss",":","float","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 (eta, n)
          A tensor of scores assigned to negative statements.
  
      Returns
      -------
      loss : float
          The loss value that must be minimized.
  
      """
      # Fix for numerical instability of multiclass loss
      scores_pos = clip_before_exp(scores_pos)
      scores_neg = clip_before_exp(scores_neg)
  
      neg_exp = tf.exp(scores_neg)
      pos_exp = tf.exp(scores_pos)
      softmax_score = pos_exp / (
          self._reduce_sample_loss(neg_exp) + pos_exp
      )
      loss = -tf.math.log(softmax_score)
      return loss
  
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 NLLMulticlass obj's underlying member method code with example usage: obj._apply_loss(scores_pos, scores_neg) and returns: loss