PairwiseLogisticLoss

class PairwiseLogisticLoss(reduction='mean')[source]

Bases: SoftMarginRankingLoss

The pairwise logistic loss.

\[L(k, \bar{k}) = \log(1 + \exp(f(\bar{k}) - f(k)))\]

Where \(k\) are the positive triples, \(\bar{k}\) are the negative triples, \(f\) is the interaction function (e.g., pykeen.models.TransE has \(f(h,r,t)=-||\mathbf{e}_h+\mathbf{e}_r-\mathbf{e}_t||_p\)), \(g(x)=\log(1 + \exp(x))\) is the softmax activation function.

See also

This loss is equivalent to pykeen.losses.SoftMarginRankingLoss where margin=0. It is also closely related to pykeen.losses.MarginRankingLoss based on the choice of activation function.

Initialize the loss.

Parameters:

reduction (str) – the reduction, cf. SoftMarginRankingLoss.__init__()

Attributes Summary

hpo_default

The default strategy for optimizing the loss's hyper-parameters

Attributes Documentation

hpo_default: ClassVar[Mapping[str, Any]] = {}

The default strategy for optimizing the loss’s hyper-parameters