Built-in loss functions.
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 labels and predictions.
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 SparseCategoricalCrossentropy
: Computes the crossentropy loss between the labels and predictions.
class SquaredHinge
: Computes the squared hinge loss between y_true
and y_pred
.
KLD(...)
: Computes Kullback-Leibler divergence loss between y_true
and y_pred
.
MAE(...)
: Computes the mean absolute error between labels and predictions.
MAPE(...)
: Computes the mean absolute percentage error between y_true
and y_pred
.
MSE(...)
: Computes the mean squared error between labels and predictions.
MSLE(...)
: Computes the mean squared logarithmic error between y_true
and y_pred
.
binary_crossentropy(...)
: Computes the binary crossentropy loss.
categorical_crossentropy(...)
: Computes the categorical crossentropy loss.
categorical_hinge(...)
: Computes the categorical hinge loss between y_true
and y_pred
.
cosine(...)
: Computes the cosine similarity between labels and predictions.
cosine_proximity(...)
: Computes the cosine similarity between labels and predictions.
cosine_similarity(...)
: Computes the cosine similarity between labels and predictions.
deserialize(...)
: Deserializes a serialized loss class/function instance.
get(...)
: Retrieves a Keras loss as a function
/Loss
class instance.
hinge(...)
: Computes the hinge loss between y_true
and y_pred
.
kl_divergence(...)
: Computes Kullback-Leibler divergence loss between y_true
and y_pred
.
kld(...)
: Computes Kullback-Leibler divergence loss between y_true
and y_pred
.
kullback_leibler_divergence(...)
: Computes Kullback-Leibler divergence loss between y_true
and y_pred
.
log_cosh(...)
: Logarithm of the hyperbolic cosine of the prediction error.
logcosh(...)
: Logarithm of the hyperbolic cosine of the prediction error.
mae(...)
: Computes the mean absolute error between labels and predictions.
mape(...)
: Computes the mean absolute percentage error between y_true
and y_pred
.
mean_absolute_error(...)
: Computes the mean absolute error between labels and predictions.
mean_absolute_percentage_error(...)
: Computes the mean absolute percentage error between y_true
and y_pred
.
mean_squared_error(...)
: Computes the mean squared error between labels and predictions.
mean_squared_logarithmic_error(...)
: Computes the mean squared logarithmic error between y_true
and y_pred
.
mse(...)
: Computes the mean squared error between labels and predictions.
msle(...)
: Computes the mean squared logarithmic error between y_true
and y_pred
.
poisson(...)
: Computes the Poisson loss between y_true and y_pred.
serialize(...)
: Serializes loss function or Loss
instance.
sparse_categorical_crossentropy(...)
: Computes the sparse categorical crossentropy loss.
squared_hinge(...)
: Computes the squared hinge loss between y_true
and y_pred
.
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/compat/v1/keras/losses