Cross-entropy measures the distance between probability distributions. In classification, it compares the model’s predicted probabilities with the ground-truth distribution and provides a loss for training. section 4.1.3
Choose the cross-entropy variant to match the classification task:
- Use binary cross-entropy for two-class classification, typically with one sigmoid output representing a probability. section 3.6.5 section 4.1.7
- Use categorical cross-entropy for multiclass classification. section 4.4
Binary classification in Keras
For a binary classifier with a sigmoid output, configure training with `loss="binary_crossentropy"`; the same choice is used for a dogs-versus-cats ConvNet. section 4.1.3 section 8.2.3
Listing 4.5 Compiling the model
model.compile( optimizer="adam", loss="binary_crossentropy", metrics=["accuracy"], )
Shows binary cross-entropy configured as the model’s loss in a Keras compile call. section 4.1.3


















