Interface Loss

All Known Implementing Classes:
BinaryCrossentropy, CategoricalCrossentropy, CategoricalHinge, CosineSimilarity, Hinge, Huber, KLDivergence, LogCosh, MeanAbsoluteError, MeanAbsolutePercentageError, MeanSquaredError, MeanSquaredLogarithmicError, Poisson, SparseCategoricalCrossentropy, SquaredHinge
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Loss
Interface for loss calc ulation
  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends TNumber>
    Operand<T>
    call(Ops tf, Operand<? extends TNumber> labels, Operand<T> predictions, Operand<T> sampleWeights)
    Generates an Operand that calculates the loss.
  • Method Details

    • call

      <T extends TNumber> Operand<T> call(Ops tf, Operand<? extends TNumber> labels, Operand<T> predictions, Operand<T> sampleWeights)
      Generates an Operand that calculates the loss.
      Type Parameters:
      T - The data type of the predictions, sampleWeights and loss.
      Parameters:
      tf - the TensorFlow Ops
      labels - the truth values or labels
      predictions - the predictions
      sampleWeights - Optional sampleWeights acts as a coefficient for the loss. If a scalar is provided, then the loss is simply scaled by the given value. If SampleWeights is a tensor of size [batch_size], then the total loss for each sample of the batch is rescaled by the corresponding element in the SampleWeights vector. If the shape of SampleWeights is [batch_size, d0, .. dN-1] (or can be broadcast to this shape), then each loss element of predictions is scaled by the corresponding value of SampleWeights. (Note on dN-1: all loss functions reduce by 1 dimension, usually axis=-1.)
      Returns:
      the loss