# theanets.losses.Hinge¶

class theanets.losses.Hinge(target, weight=1.0, weighted=False, output_name='out')

Hinge loss function for classifiers.

Notes

The hinge loss as implemented here computes the maximum difference between the prediction $$q(x=k)$$ for a class $$k$$ and the prediction $$q(x=t)$$ for the correct class $$t$$:

$\mathcal{L}(x, t) = \max(0, \max_k q(x=k) - q(x=t))$

This loss is zero whenever the prediction for the correct class is the largest over classes, and increases linearly when the prediction for an incorrect class is the largest.

__init__(target, weight=1.0, weighted=False, output_name='out')

Methods

 __init__(target[, weight, weighted, output_name]) accuracy(outputs) Build a Theano expression for computing the accuracy of graph output. log() Log some diagnostic info about this loss.

Attributes

 variables A list of Theano variables used in this loss.