SquareErrorLoss
- class KGE.loss.SquareErrorLoss[source]
Bases:
KGE.loss.LossAn implementation of Square Error Loss.
Square Error Loss is a loss function used in RESCAL, it computes the squared difference between triplet scores \(f((h,r,t)_i)\) and labels (\(y_i = 1~or~0\)):
\[\mathscr{L} = \sum_i \left( f((h,r,t)_i) - y_i \right)^2\]Methods Summary
__call__(pos_score, neg_score)Calculate loss.
Methods Documentation
- __call__(pos_score, neg_score)[source]
Calculate loss.
- Parameters
pos_score (
tf.Tensor) – score of postive triplets, with shape(n,)neg_score (
tf.Tensor) – score of negative triplets, with shape(n,)
- __new__(*args, **kwargs)