New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modified documentation for SparseCategoricalCrossentropy #34343
Conversation
The documentation example for SparseCategoricalCrossentropy is mathematically inconsistent with a parallel example given for CategoricalCrossentropy and also is confusing. In particular the second element in the original SparseCategoricalCrossentropy example function call has component given by [.5, .89, .6] which is not normalized to be a probability (i.e. doesn't sum to 1.0). I modified it to be [.05, .89, .06] which does sum to 1.0 and also recomputed the loss to be 0.09458992, preserving all the precision from the function call. I hope this helps clarify things for users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you try putting the usage example in doctest format as in this guide below? https://www.tensorflow.org/community/contribute/docs_ref
@td2014 Can you please resolve conflicts? Thanks! |
It has been 14 days with no activity and the |
Closing this PR as the docs have been updated. |
The documentation example for SparseCategoricalCrossentropy is mathematically inconsistent with a parallel example given for CategoricalCrossentropy and also is confusing. In particular the second element in the original SparseCategoricalCrossentropy example function call has component given by [.5, .89, .6] which is not normalized to be a probability (i.e. doesn't sum to 1.0). I modified it to be [.05, .89, .06] which does sum to 1.0 and also recomputed the loss to be 0.09458992, preserving all the precision from the function call. I hope this helps clarify things for users. Thanks.