Type BinaryCrossentropy
Namespace tensorflow.keras.losses
Parent LossFunctionWrapper
Interfaces IBinaryCrossentropy
Computes the cross-entropy loss between true labels and predicted labels. Use this cross-entropy loss when there are only two label classes (assumed to
be 0 and 1). For each example, there should be a single floating-point value
per prediction. In the snippet below, each of the four examples has only a single
floating-pointing value, and both `y_pred` and `y_true` have the shape
`[batch_size]`. Usage:
Usage with the
tf.keras
API:
Show Example
bce = tf.keras.losses.BinaryCrossentropy() loss = bce([0., 0., 1., 1.], [1., 1., 1., 0.]) print('Loss: ', loss.numpy()) # Loss: 11.522857