Skip to main content
AI & ML Bug Hunt Hard +35 XP

Wrong Loss Function

This binary classifier uses the wrong loss.

AI & MLFind the bug
1model.compile(optimizer="adam",
2 loss="categorical_crossentropy")
The bug is on line 2

Select the correct fix

Show answer and explanation

Answer: Use binary_crossentropy for binary classification

categorical_crossentropy is for multi-class. Binary classification (2 classes) needs binary_crossentropy.

Hint: Match the loss function to the number of output classes.

What this challenge tests

Bug Hunt in AI & ML: keras, loss-functions.

Related challenges