LinkPredictAdvBCELossFunc
- class graphstorm.model.LinkPredictAdvBCELossFunc(adversarial_temperature)
Bases:
LinkPredictBCELossFuncBinary cross entropy loss function for link prediction tasks with adversarial loss for negative samples.
The loss of positive edges is defined as:
\[loss_{pos} = - \log score\]where
scoreis the score value of the positive edges computed by the score function.The loss of negative edges is defined as:
\[\begin{split}loss_{neg} = \log (1 - score) \\ loss_{neg} = \mathrm{softmax}(score * adversarial\_temperature) * loss_{neg}\end{split}\]where
scoreis the score value of the negative edges computed by the score function andadversarial_temperatureis a hyper-parameter.The final loss is defined as:
\[loss = \dfrac{\mathrm{avg}(loss_{pos}) + \mathrm{avg}(loss_{neg})}{2}\]Parameters
- adversarial_temperature: float
Temperature value for adversarial loss.