Join us at TensorFlow World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

Module: tf.compat.v2.keras.losses

View source on GitHub

Built-in loss functions.

Aliases:

  • Module tf.compat.v2.losses

Classes

class BinaryCrossentropy: Computes the cross-entropy loss between true labels and predicted labels.

class CategoricalCrossentropy: Computes the crossentropy loss between the labels and predictions.

class CategoricalHinge: Computes the categorical hinge loss between y_true and y_pred.

class CosineSimilarity: Computes the cosine similarity between y_true and y_pred.

class Hinge: Computes the hinge loss between y_true and y_pred.

class Huber: Computes the Huber loss between y_true and y_pred.

class KLDivergence: Computes Kullback Leibler divergence loss between y_true and y_pred.

class LogCosh: Computes the logarithm of the hyperbolic cosine of the prediction error.

class Loss: Loss base class.

class MeanAbsoluteError: Computes the mean of absolute difference between labels and predictions.

class MeanAbsolutePercentageError: Computes the mean absolute percentage error between y_true and y_pred.

class MeanSquaredError: Computes the mean of squares of errors between labels and predictions.

class MeanSquaredLogarithmicError: Computes the mean squared logarithmic error between y_true and y_pred.

class Poisson: Computes the Poisson loss between y_true and y_pred.

class Reduction: Types of loss reduction.

class SparseCategoricalCrossentropy: Computes the crossentropy loss between the labels and predictions.

class SquaredHinge: Computes the squared hinge loss between y_true and y_pred.

Functions

KLD(...)

MAE(...)

MAPE(...)

MSE(...)

MSLE(...)

binary_crossentropy(...)

categorical_crossentropy(...): Computes the categorical crossentropy loss.

categorical_hinge(...)

cosine_similarity(...): Computes the cosine similarity between labels and predictions.

deserialize(...)

get(...)

hinge(...): Computes the hinge loss between y_true and y_pred.

kld(...)

kullback_leibler_divergence(...)

logcosh(...): Logarithm of the hyperbolic cosine of the prediction error.

mae(...)

mape(...)

mean_absolute_error(...)

mean_absolute_percentage_error(...)

mean_squared_error(...)

mean_squared_logarithmic_error(...)

mse(...)

msle(...)

poisson(...)

serialize(...)

sparse_categorical_crossentropy(...)

squared_hinge(...): Computes the squared hinge loss between y_true and y_pred.