Type CategoricalHinge
Namespace tensorflow.keras.losses
Parent LossFunctionWrapper
Interfaces ICategoricalHinge
Computes the categorical hinge loss between `y_true` and `y_pred`. `loss = maximum(neg - pos + 1, 0)`
where `neg = sum(y_true * y_pred)` and `pos = maximum(1 - y_true)` Usage:
Usage with the `compile` API:
Show Example
ch = tf.keras.losses.CategoricalHinge() loss = ch([0., 1., 1.], [1., 0., 1.]) print('Loss: ', loss.numpy()) # Loss: 1.0