NSSALoss¶
-
class
NSSALoss
(margin=9.0, adversarial_temperature=1.0, reduction='mean')[source]¶ Bases:
pykeen.losses.SetwiseLoss
An implementation of the self-adversarial negative sampling loss function proposed by [sun2019].
Initialize the NSSA loss.
- Parameters
margin (
float
) – The loss’s margin (also written as gamma in the reference paper)adversarial_temperature (
float
) – The negative sampling temperature (also written as alpha in the reference paper)reduction (
str
) – The name of the reduction operation to aggregate the individual loss values from a batch to a scalar loss value. From {‘mean’, ‘sum’}.
Note
The default hyperparameters are based the experiments for FB15K-237 in [sun2019].
Attributes Summary
The default strategy for optimizing the model’s hyper-parameters
Methods Summary
forward
(pos_scores, neg_scores)Calculate the loss for the given scores.
Attributes Documentation
-
hpo_default
: ClassVar[Mapping[str, Any]] = {'adversarial_temperature': {'high': 1.0, 'low': 0.5, 'type': <class 'float'>}, 'margin': {'high': 30, 'low': 3, 'q': 3, 'type': <class 'int'>}}¶ The default strategy for optimizing the model’s hyper-parameters
-
synonyms
: ClassVar[Optional[Set[str]]] = {'Negative Sampling Self-Adversarial Loss', 'Self-Adversarial Negative Sampling Loss'}¶
Methods Documentation