Losses and metrics for Keras

https://machinelearningmastery.com/custom-metrics-deep-learning-keras-python/
https://machinelearningmastery.com/how-to-choose-loss-functions-when-training-deep-learning-neural-networks/

0. Classification Label

  1. One-hot Label (Default): [0,0,1] [0,1,0] [1,0,0]
  2. Sparse Label: [1] [2] [3]

1. Losses

1.1 Regression

  1. Mean Squared Error Loss: mse, or mean_squared_error
  2. Mean Squared Logarithmic Error Loss: mean_squared_logarithmic_error, or msle
  3. Mean Absolute Error Loss: mean_absolute_error, or mae
  4. Others: mape

1.2 Binary Classification

  1. Binary Cross-Entropy: binary_crossentropy
  2. Hinge Loss: hinge
  3. Squared Hinge Loss: squared_hinge

1.3 Multi-Class Classification

  1. Multi-Class Cross-Entropy Loss: categorical_crossentropy
  2. Sparse Multiclass Cross-Entropy Loss: sparse_categorical_crossentropy
  3. Kullback Leibler Divergence Loss: kullback_leibler_divergence

2 Metrics

2.1 Regression Metrics

  1. Mean Squared Error: mean_squared_error, MSE or mse
  2. Mean Absolute Error: mean_absolute_error, MAE, mae
  3. Mean Absolute Percentage Error: mean_absolute_percentage_error,
    MAPE, mape
  4. Cosine Proximity: cosine_proximity, cosine

2.2 Binary Classification Metrics

  1. Binary Accuracy: binary_accuracy, acc
  2. Sparse Categorical Accuracy: sparse_categorical_accuracy

2.3 Multi-Classification Metrics

  1. Categorical Accuracy: categorical_accuracy, acc
  2. Sparse Categorical Accuracy: sparse_categorical_accuracy
  3. Top k Categorical Accuracy: top_k_categorical_accuracy (requires you specify a k parameter)
  4. Sparse Top k Categorical Accuracy: sparse_top_k_categorical_accuracy (requires you specify a k parameter)

猜你喜欢

转载自blog.csdn.net/weixin_43713224/article/details/109031037