How to choose cross-entropy loss in tensorflow?
machine learning - How to choose cross-entropy loss in tensorflow? - Stack Overflow
https://stackoverflow.com/questions/47034888/how-to-choose-cross-entropy-loss-in-tensorflow
0down votefavorite 1 | Classification problems, such as logistic regression or multinomial logistic regression, optimize a cross-entropy loss. Normally, the cross-entropy layer follows the softmax layer, which produces probability distribution. In tensorflow, there are at least a dozen of different cross-entropy loss functions:
Which work only for binary classification and which are suitable for multi-class problems? When should you use Related (more math-oriented) discussion: cross-entropy jungle. machine-learning tensorflow neural-network logistic-regression cross-entropy
| |||
1 Answer
Preliminary facts
Sigmoid functions family
As stated earlier, The labels must be one-hot encoded or can contain soft class probabilities.
Softmax functions family
These loss functions should be used for multinomial mutually exclusive classification, i.e. pick one out of The labels must be one-hot encoded or can contain soft class probabilities: a particular example can belong to class A with 50% probability and class B with 50% probability. Note that strictly speaking it doesn't mean that it belongs to both classes, but one can interpret the probabilities this way. Just like in Sparse functions family
Like ordinary Like above, Sampled softmax functions familyThese functions provide another alternative for dealing with huge number of classes. Instead of computing and comparing an exact probability distribution, they compute a loss estimate from a random sample. The arguments Like above, Sampled functions are only suitable for training. In test time, it's recommended to use a standard Another alternative loss is |
further reading:
machine learning - How to choose cross-entropy loss in tensorflow? - Stack Overflow
https://stackoverflow.com/questions/47034888/how-to-choose-cross-entropy-loss-in-tensorflow
python - Keras: binary_crossentropy & categorical_crossentropy confusion - Stack Overflow
https://stackoverflow.com/questions/47877083/keras-binary-crossentropy-categorical-crossentropy-confusion