AbsoluteMarginLoss

class ampligraph.latent_features.AbsoluteMarginLoss(eta, loss_params=None, verbose=False)

Absolute margin , max-margin loss.

Introduced in [HOSM17].

\[\mathcal{L}(\Theta) = \sum_{t^+ \in \mathcal{G}}\sum_{t^- \in \mathcal{C}} f_{model}(t^-;\Theta) - max(0, [\gamma - f_{model}(t^+;\Theta)])\]

where \(\gamma\) is the margin, \(\mathcal{G}\) is the set of positives, \(\mathcal{C}\) is the set of corruptions, \(f_{model}(t;\Theta)\) is the model-specific scoring function.

Methods

__init__(eta[, loss_params, verbose])

Initialize Loss

__init__(eta, loss_params=None, verbose=False)

Initialize Loss

Parameters
  • eta (int) – Number of negatives.

  • loss_params (dict) –

    Dictionary of loss-specific hyperparams:

    • ’margin’: float. Margin to be used in pairwise loss computation (default:1)

    Example: loss_params={'margin': 1}