BinaryCrossentropy

public class BinaryCrossentropy

A Metric that computes the binary cross-entropy loss between true labels and predicted labels.

This is the crossentropy metric class to be used when there are only two label classes (0 and 1).

Inherited Constants

Public Constructors

BinaryCrossentropy(Ops tf, String name, boolean fromLogits, float labelSmoothing, long seed, Class<T> type)
Creates a BinaryCrossentropy metric

Public Methods

Operand<T>
call(Operand<? extends TNumber> labels, Operand<? extends TNumber> predictions)
Calculates the weighted loss between labels and predictions

Inherited Methods

Public Constructors

public BinaryCrossentropy (Ops tf, String name, boolean fromLogits, float labelSmoothing, long seed, Class<T> type)

Creates a BinaryCrossentropy metric

Parameters
tf the TensorFlow Ops
name the name of this metric, if null then metric name is getSimpleName().
fromLogits Whether to interpret predictions as a tensor of logit values as opposed to a probability distribution.
labelSmoothing value used to smooth labels, When 0, no smoothing occurs. When > 0, compute the loss between the predicted labels and a smoothed version of the true labels, where the smoothing squeezes the labels towards 0.5. Larger values of label_smoothing correspond to heavier smoothing.
seed the seed for random number generation. An initializer created with a given seed will always produce the same random tensor for a given shape and data type.
type the type for the variables and result

Public Methods

public Operand<T> call (Operand<? extends TNumber> labels, Operand<? extends TNumber> predictions)

Calculates the weighted loss between labels and predictions

Parameters
labels the truth values or labels
predictions the predictions
Returns
  • the loss