-
Notifications
You must be signed in to change notification settings - Fork 413
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
Improve confusion matrix plotting #2358
Conversation
Round floats to avoid floating point errors leading to UI overflow. Remove overlapping text in multilabel plots by reducing redundant `Predicted class` and `True class` labels. Use `constrained_layout` to prevent some text from being cut off.
for more information, see https://pre-commit.ci
yes, the readability for binary cases is bad, just thinking about making the long labels as multi-line or smaller font? 🤔 |
If I have the time, I will look into multiline labels this week. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2358 +/- ##
======================================
- Coverage 69% 69% -0%
======================================
Files 303 303
Lines 17058 17060 +2
======================================
Hits 11760 11760
- Misses 5298 5300 +2 |
@JonasVerbickas thanks for the contribution. We are going to merge this PR such that it become part of the v1.3.1release. Feel free to send a new PR with further improvements to the plotting capabilities of torchmetrics. |
Round floats to avoid floating point errors leading to UI overflow. Remove overlapping text in multilabel plots by reducing redundant `Predicted class` and `True class` labels. Use `constrained_layout` to prevent some text from being cut off. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Nicki Skafte Detlefsen <[email protected]> (cherry picked from commit 71089f0)
Round floats to avoid floating point errors leading to UI overflow. Remove overlapping text in multilabel plots by reducing redundant `Predicted class` and `True class` labels. Use `constrained_layout` to prevent some text from being cut off. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Nicki Skafte Detlefsen <[email protected]> (cherry picked from commit 71089f0)
What does this PR do?
Current confusion matrix plotting tends to produce unusable results.
When I tried to create a normalized multilabel confusion matrix plot this cluttered mess was produced:
val.item()
produces numbers with too many decimal places.Round floats to avoid floating point errors leading to UI overflow.
Rounding to two decimal places seems reasonable since it's difficult to fit more digits into multilabel confusion matrices.
Changing this line converts this plot:
Removing redundant "True class" and "Predicted class"
Code reducing the number of times x and y labels are shown:
Produces a much cleaner plot without sacrificing any information:
Reduce overlap
By utilizing
constrained_layout=True
:Reduces overlap between labels horizontally and vertically from {0, 1} ticks:
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃
📚 Documentation preview 📚: https://torchmetrics--2358.org.readthedocs.build/en/2358/