|View source on GitHub|
Adds Ops for computing the multiclass hinge loss.
tf.contrib.kernel_methods.sparse_multiclass_hinge_loss( labels, logits, weights=1.0, scope=None, loss_collection=tf.GraphKeys.LOSSES, reduction=losses.Reduction.SUM_BY_NONZERO_WEIGHTS )
The implementation is based on the following paper: On the Algorithmic Implementation of Multiclass Kernel-based Vector Machines by Crammer and Singer. link: http://jmlr.csail.mit.edu/papers/volume2/crammer01a/crammer01a.pdf
This is a generalization of standard (binary) hinge loss. For a given instance
with correct label c, the loss is given by:
Tensorof shape [batch_size] or [batch_size, 1]. Corresponds to the ground truth. Each entry must be an index in
Tensorof shape [batch_size, num_classes] corresponding to the unscaled logits. Its dtype should be either
weights: Optional (python) scalar or
Tensor. If a non-scalar
Tensor, its rank should be either 1 ([batch_size]) or 2 ([batch_size, 1]).
scope: The scope for the operations performed in computing the loss.
loss_collection: collection to which the loss will be added.
reduction: Type of reduction to apply to loss.
Weighted loss float
NONE, this has the same
labels; otherwise, it is a scalar.
weightshave invalid or inconsistent shapes.
labelstensor has invalid dtype.