SoftPointwiseHingeLoss

class SoftPointwiseHingeLoss(margin: float = 1.0, reduction: Literal['mean', 'sum'] = 'mean')[source]

Bases: DeltaPointwiseLoss

The soft pointwise hinge loss.

This loss is appropriate for interaction functions which do not include a bias term, and have a limited value range, e.g., distance-based ones like TransE.

See also

When choosing margin=0, this loss becomes equivalent to SoftplusLoss. It is also closely related to PointwiseHingeLoss, only differing in that this loss uses the softmax activation and PointwiseHingeLoss uses the ReLU activation.

Initialize the loss.

Parameters:
  • margin (float) – the margin, cf. DeltaPointwiseLoss.__init__()

  • reduction (Literal['mean', 'sum']) – the reduction, cf. DeltaPointwiseLoss.__init__()

Attributes Summary

hpo_default

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

Attributes Documentation

hpo_default: ClassVar[Mapping[str, Any]] = {'margin': {'high': 3, 'low': 0, 'type': <class 'float'>}}

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