Skip to content
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

Matrix plot and Track Origin confusion matrix #258

Merged
merged 17 commits into from
Mar 31, 2024

Conversation

LucioDerin
Copy link
Contributor

@LucioDerin LucioDerin commented Mar 11, 2024

Summary

This pull request introduces the following changes

  • Added the class MatshowPlot dedicated to matrix plots, based on matplotlib's matshow (can be found in puma.matshow).
  • Added the function confusion_matrix to compute a confusion matrix from target and predicted labels of a classifier. Can be found in puma.utils.confusion_matrix.
  • Added the confusion matrix plot for the Track Origin Auxiliary Task, as a method in the AuxResults class. The result on the dummy_GN2 tagger is attached at the end.

Relates to the following issues

  • Mildly related to issue #107, as the MatshowPlot class can be used to plot the saliency map once it's computed (a similar plot, obtained with the MatshowPlot class and implemented in the examples, is attached at the end).

Conformity

Examples

Track Origin Confusion Matrix

dummy_GN2_trackorigin_cm

A general matrix plot (inspired to the saliency map)

mat

Copy link

codecov bot commented Mar 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.89%. Comparing base (830a27f) to head (2caf36b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #258      +/-   ##
==========================================
+ Coverage   97.81%   97.89%   +0.08%     
==========================================
  Files          43       47       +4     
  Lines        4661     4852     +191     
==========================================
+ Hits         4559     4750     +191     
  Misses        102      102              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@LucioDerin LucioDerin changed the title Matrix plot and Track Origin confusion matrix Draft: Matrix plot and Track Origin confusion matrix Mar 11, 2024
puma/hlplots/aux_results.py Outdated Show resolved Hide resolved
puma/hlplots/aux_results.py Outdated Show resolved Hide resolved
puma/matshow.py Outdated Show resolved Hide resolved
@LucioDerin LucioDerin marked this pull request as ready for review March 18, 2024 14:52
@LucioDerin LucioDerin changed the title Draft: Matrix plot and Track Origin confusion matrix Matrix plot and Track Origin confusion matrix Mar 18, 2024
Copy link
Contributor

@dkobylianskii dkobylianskii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this MR, it looks really good.
I've added some minor comments

docs/examples/confusion_matrix.md Outdated Show resolved Hide resolved
docs/examples/matrix_plot.md Outdated Show resolved Hide resolved
examples/plot_matshow.py Outdated Show resolved Hide resolved
puma/matshow.py Outdated Show resolved Hide resolved
puma/matshow.py Outdated Show resolved Hide resolved
puma/matshow.py Outdated Show resolved Hide resolved
puma/matshow.py Show resolved Hide resolved
Copy link
Contributor

@dkobylianskii dkobylianskii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for implementing this, @LucioDerin

@dkobylianskii dkobylianskii merged commit 2850770 into umami-hep:main Mar 31, 2024
9 checks passed
@LucioDerin LucioDerin deleted the matrix-plot branch April 21, 2024 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants