[EXTERNAL] Correct multi-class loss function to categorical_crossentropy#3028
Merged
MSilva95 merged 1 commit into01-edu:masterfrom Oct 27, 2025
Merged
[EXTERNAL] Correct multi-class loss function to categorical_crossentropy#3028MSilva95 merged 1 commit into01-edu:masterfrom
MSilva95 merged 1 commit into01-edu:masterfrom
Conversation
correct multi-class loss function to categorical_crossentropy
MSilva95
approved these changes
Oct 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why?
The README incorrectly stated that binary_crossentropy is the extension of log loss for multi-class classification. This is misleading because binary_crossentropy is only appropriate for binary or multi-label tasks, not single-label multi-class tasks.
Solution Overview
Updated the README to specify that categorical_crossentropy (or sparse_categorical_crossentropy if labels are integers) is the correct loss function for multi-class classification in Keras.
Implementation Details
Replaced reference to binary_crossentropy in the multi-class section with categorical_crossentropy.
Added a brief clarification on when to use sparse_categorical_crossentropy.
Left binary classification explanation unchanged.