DeltaPointwiseLoss

class DeltaPointwiseLoss(margin=0.0, margin_activation='softplus', reduction='mean')[source]

Bases: pykeen.losses.PointwiseLoss

A generic class for delta-pointwise losses.

Pointwise Loss

Activation

Margin

Formulation

Implementation

Pointwise Hinge

ReLU

\(\lambda \neq 0\)

\(g(s, l) = \max(0, \lambda -\hat{l}*s)\)

pykeen.losses.PointwiseHingeLoss

Soft Pointwise Hinge

softplus

\(\lambda \neq 0\)

\(g(s, l) = \log(1+\exp(\lambda -\hat{l}*s))\)

pykeen.losses.SoftPointwiseHingeLoss

Pointwise Logistic (softplus)

softplus

\(\lambda = 0\)

\(g(s, l) = \log(1+\exp(-\hat{l}*s))\)

pykeen.losses.SoftplusLoss

Initializes internal Module state, shared by both nn.Module and ScriptModule.

Methods Summary

forward(logits, labels)

Calculate the loss for the given scores and labels.

Methods Documentation

forward(logits, labels)[source]

Calculate the loss for the given scores and labels.

Return type

FloatTensor