Reputation: 101
Here describes different loss functions, but it is possible to use abbreviations instead of importing and passing the actual loss object (see an examples here)
MeanSquaredError
can be passed as the string mse
, MeanAbsoluteError
as mae
. Some are obvious like that, but what about other losses like CategoricalCrossentropy
, CosineSimilarity
, or Hinge
?
Upvotes: 3
Views: 802
Reputation: 4980
Here are some loss functions and their string aliases (All of them can be imported from tf.keras.losses
):
Class Name | String Alias(es) |
---|---|
MeanSquaredError() | mean_squared_error , mse , MSE |
MeanAbsoluteError() | mean_absolute_error , mae , MAE |
MeanAbsolutePercentageError() | mean_absolute_percentage_error , mape , MAPE |
MeanSquaredLogarithmicError() | mean_squared_logarithmic_error , msle , MSLE |
KLDivergence() | kl_divergence , kullback_leibler_divergence , kld , KLD |
Hinge() | hinge |
CosineSimilarity() | cosine_similarity |
LogCosh() | log_cosh , logcosh |
CategoricalCrossentropy() | categorical_crossentropy |
SparseCategoricalCrossentropy() | sparse_categorical_crossentropy |
BinaryCrossentropy() | binary_crossentropy |
As you can see, some of them have more than one string alias, whereas mostly have one alias.
Reference: Source code of keras.losses
Upvotes: 7