code: def categorical_hinge(expected, predicted, delta=1):
      """
      Computes the multi-class hinge loss between
      predictions and targets.
  
      .. math::
          hinge_{i}(t, o) = \\max_{j \\not = o_i} (0, t_j - t_{o_i} + \\delta)
  
      Parameters
      ----------
      expected : Tensorfow 2D tensor or 1D tensor
          Either a vector of int giving the correct class index
          per data point or a 2D tensor of one-hot encoding of
          the correct class in the same layout as predictions
          (non-binary targets in [0, 1] do not work!).
  
      predicted : Tensorfow 2D tensor
          Predictions in (0, 1), such as softmax output of
          a neural network, with data points in rows and class
          probabilities in columns.
  
      delta : scalar
          The hinge loss margin. Defaults to ``1``.
  
      Returns
      -------
      Tensorfow 1D tensor
          An expression for the average multi-class hinge loss.
  
      Notes
      -----
      This is an alternative to the categorical cross-entropy
      loss for multi-class classification problems.
      """
      shape = tf.shape(expected)
      n_samples = asfloat(shape[0])
  
      positive = tf.reduce_sum(expected * predicted, axis=-1)
      negative = tf.reduce_max(
          (asfloat(1) - expected) * predicted, axis=-1
      )
      errors = tf.nn.relu(negative - positive + asfloat(1))
      return tf.reduce_sum(errors) / n_samples
  
file_path: neupy/neupy/algorithms/gd/objectives.py
imports: from __future__ import division
  import tensorflow
  from neupy.core.docs import shared_docs
  from neupy.utils import asfloat, function_name_scope
label_desc: Use image node_id 10 for calling a global function with example usage: categorical_hinge(expected, predicted, delta) and returns: unknown