DeltaPointwiseLoss
- class DeltaPointwiseLoss(margin: float | None = 0.0, margin_activation: str | Module | None = 'softplus', reduction: str = 'mean')[source]
Bases:
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)\)
Soft Pointwise Hinge
softplus
\(\lambda \neq 0\)
\(g(s, l) = \log(1+\exp(\lambda -\hat{l}*s))\)
Pointwise Logistic (softplus)
softplus
\(\lambda = 0\)
\(g(s, l) = \log(1+\exp(-\hat{l}*s))\)
Initialize the loss.
- Parameters:
Attributes Summary
The default strategy for optimizing the loss's hyper-parameters
Methods Summary
forward
(logits, labels)Calculate the loss for the given scores and labels.
Attributes Documentation
- hpo_default: ClassVar[Mapping[str, Any]] = {'margin': {'high': 3, 'low': 0, 'type': <class 'float'>}, 'margin_activation': {'choices': {'hard', 'relu', 'soft', 'softplus'}, 'type': 'categorical'}}
The default strategy for optimizing the loss’s hyper-parameters
Methods Documentation