W3cubDocs

/TensorFlow

tf.keras.losses.CategoricalHinge

Computes the categorical hinge loss between y_true & y_pred.

Inherits From: Loss

Formula:

loss = maximum(neg - pos + 1, 0)

where neg=maximum((1-y_true)*y_pred) and pos=sum(y_true*y_pred)

Args
reduction Type of reduction to apply to the loss. In almost all cases this should be "sum_over_batch_size". Supported options are "sum", "sum_over_batch_size" or None.
name Optional name for the loss instance.

Methods

call

View source

from_config

View source

get_config

View source

__call__

View source

Call self as a function.

© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/keras/losses/CategoricalHinge