Fix definition of entropy in NMI docstring#7750
Merged
jni merged 4 commits intoscikit-image:mainfrom Mar 13, 2025
vcasellesb:fix-docstring-nmi
Merged
Fix definition of entropy in NMI docstring#7750jni merged 4 commits intoscikit-image:mainfrom vcasellesb:fix-docstring-nmi
jni merged 4 commits intoscikit-image:mainfrom
vcasellesb:fix-docstring-nmi
Conversation
stefanv
reviewed
Mar 12, 2025
skimage/metrics/simple_metrics.py
Outdated
| where :math:`H(X) := - \sum_{x \in X}{x \log x}` is the entropy. | ||
| where :math:`H(X) := - \sum_{x \in X}{p(x) \log p(x)}` is the entropy, | ||
| :math:`X` is the set of image values, and :math:`p(x)` is the probability | ||
| of observing a specific value :math:`x \in X`. |
Member
There was a problem hiding this comment.
The only thing I'm nervous about here is the word "observing", which I think is overloaded. "encountering", or "x occurring in X"?
Contributor
Author
There was a problem hiding this comment.
I've changed it to:
`p(x)` is the probability of ocurrence of a specific value `x \in X`.
Does that sound better? Thanks!
Member
|
Thank you @vcasellesb! |
jni
reviewed
Mar 13, 2025
jni
approved these changes
Mar 13, 2025
Member
|
I pushed a minor typo and wording fix @vcasellesb (4d23f25), but imho this is ready now! Thank you! |
Member
|
I checked the CI docs build (here) and everything looked good, so I merged. Thanks @vcasellesb! |
Contributor
Author
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.
See discussion at:
https://skimage.zulipchat.com/#narrow/channel/175598-general/topic/entropy.20formula.20.28in.20metrics.2Enormalized_mutual_information.29
Description
Hi! As commented on the linked topic from scikit-image's Zulip, I have changed NMI's docstring so that the entropy formula is better specified. This is just a documentation change, so I'm guessing no unit tests are required. However, I would recommend checking I haven't messed up using latex's math inside python, since I'm new to writing proper docs.
Release note
For maintainers and optionally contributors, please refer to the instructions on how to document this PR for the release notes.