criterion = L1HingeEmbeddingCriterion(margin)
Creates a criterion that measures the loss given an input
x
= {x1,x2}
, a table of two tensors, and a label y
(1 or -1):
This is used for measuring whether two inputs are similar
or dissimilar, using the L1 distance, and is typically used for
learning nonlinear embeddings or semi-supervised learning.
loss(x,y) = forward(x,y) = ||x1-x2||_1, if y=1 = max(0,margin - ||x1-x2||_1), if y=-1
The margin
has a default value of 1, or can be set in the constructor:
criterion = L1HingeEmbeddingCriterion(marginValue)