LinkPredictBCELossFunc
- class graphstorm.model.LinkPredictBCELossFunc(*args, **kwargs)
Bases:
GSLayerLoss function for link prediction tasks using binary cross entropy loss.
The
torch.nn.functional.binary_cross_entropy_with_logitsis used to compute the loss. The loss function is defined as:\[loss = - y \cdot \log score + (1 - y) \cdot \log (1 - score)\]where
yis 1 for a positive edge and 0 for a negative edge.scoreis the score value of the edges computed by the score function.