class_docstr: Absolute margin, max-margin loss.
  
  Introduced in :cite:`Hamaguchi2017`.
  
  .. math::
  
      \mathcal{L}(\Theta) = \sum_{t^+ \in \mathcal{G}}\sum_{t^- \in \mathcal{C}}
      max(0, [\gamma - f_{model}(t^-;\Theta)]) - f_{model}(t^+;\Theta)
  
  where :math:`\gamma` is the margin, :math:`\mathcal{G}` is the set of positives, :math:`\mathcal{C}` is the
  set of corruptions, :math:`f_{model}(t;\Theta)` is the model-specific scoring function.
  
  Example
  -------
  >>> import ampligraph.latent_features.loss_functions as lfs
  >>> loss = lfs.AbsoluteMarginLoss({'margin': 1, 'reduction': 'mean'})
  >>> isinstance(loss, lfs.AbsoluteMarginLoss)
  True
  
  >>> loss = lfs.get('absolute_margin')
  >>> isinstance(loss, lfs.AbsoluteMarginLoss)
  True
class_docstr_tok: ["Absolute","margin",",","max-margin","loss",".","Introduced","in",":","cite",":","`","Hamaguchi2017","`",".","..","math",":",":","\\mathcal","{","L","}","(","\\Theta",")","=","\\sum_","{","t^+","\\in","\\mathcal","{","G","}","}","\\sum_","{","t^-","\\in","\\mathcal","{","C","}","}","max","(","0",",","[","\\gamma","-","f_","{","model","}","(","t^-",";","\\Theta",")","]",")","-","f_","{","model","}","(","t^+",";","\\Theta",")","where",":","math",":","`","\\gamma","`","is","the","margin",",",":","math",":","`","\\mathcal","{","G","}","`","is","the","set","of","positives",",",":","math",":","`","\\mathcal","{","C","}","`","is","the","set","of","corruptions",",",":","math",":","`","f_","{","model","}","(","t",";","\\Theta",")","`","is","the","model-specific","scoring","function",".","Example","--","--","--","-",">",">",">","import","ampligraph.latent_features.loss_functions","as","lfs",">",">",">","loss","=","lfs.AbsoluteMarginLoss","(","{","'margin","'",":","1",",","'reduction","'",":","'mean","'","}",")",">",">",">","isinstance","(","loss",",","lfs.AbsoluteMarginLoss",")","True",">",">",">","loss","=","lfs.get","(","'absolute_margin","'",")",">",">",">","isinstance","(","loss",",","lfs.AbsoluteMarginLoss",")","True"]
docstr: Initialize the loss.
  
  Parameters
  ----------
  loss_params : dict
      Dictionary of loss-specific hyperparams:
  
      - `"margin"`: (float) - Margin to be used in pairwise loss computation (default: 1).
      - `"reduction"`: (str) - Specifies whether to `"sum"` or take `"mean"` of loss per sample w.r.t.            corruption (default: `"sum"`).
  
      Example: ``loss_params={'margin': 1}``.
docstr_tok: ["Initialize","the","loss",".","Parameters","--","--","--","--","--","loss_params",":","dict","Dictionary","of","loss-specific","hyperparams",":","-","`","``","margin","''","`",":","(","float",")","-","Margin","to","be","used","in","pairwise","loss","computation","(","default",":","1",")",".","-","`","``","reduction","''","`",":","(","str",")","-","Specifies","whether","to","`","``","sum","''","`","or","take","`","``","mean","''","`","of","loss","per","sample","w.r.t",".","corruption","(","default",":","`","``","sum","''","`",")",".","Example",":","``","loss_params=","{","'margin","'",":","1","}","``","."]
code: def __init__(self, loss_params={}, verbose=False):
      """Initialize the loss.
  
          Parameters
          ----------
          loss_params : dict
              Dictionary of loss-specific hyperparams:
  
              - `"margin"`: (float) - Margin to be used in pairwise loss computation (default: 1).
              - `"reduction"`: (str) - Specifies whether to `"sum"` or take `"mean"` of loss per sample w.r.t.\
              corruption (default: `"sum"`).
  
              Example: ``loss_params={'margin': 1}``.
          """
      super().__init__(loss_params, verbose)
  
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 1 to create a new AbsoluteMarginLoss object from inherited base classes: Loss with example: obj = AbsoluteMarginLoss(loss_params, verbose)