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

Add recall #2518

Merged
merged 11 commits into from
Dec 20, 2024
Merged

Add recall #2518

merged 11 commits into from
Dec 20, 2024

Conversation

tsanona
Copy link
Contributor

@tsanona tsanona commented Nov 20, 2024

Pull Request Template

Checklist

  • Confirmed that run-checks all script has been executed.
  • Made sure the book is up to date with changes in this PR.

Related Issues/PRs

#544

Changes

Create ClassificationInput and ClassificationConfig, generalizations of PrecisionInput and PrecisionConfig for any classification task (currently used by precision and recall).
Add RecallMetric.

Moved ClassReduction into ClassificationConfig, since i think they belong together.

Testing

Added tests for recall

Tiago Sanona added 3 commits November 20, 2024 20:50
…h RecallMetric. Adapt confusionStats and Precision with generalized code.
… rename test function properly in precision.
@laggui laggui self-requested a review November 25, 2024 14:27
Copy link
Member

@laggui laggui left a comment

Choose a reason for hiding this comment

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

I have a couple of comments, otherwise good start! 🙂

crates/burn-train/src/metric/classification.rs Outdated Show resolved Hide resolved
crates/burn-train/src/metric/classification.rs Outdated Show resolved Hide resolved
crates/burn-train/src/metric/classification.rs Outdated Show resolved Hide resolved
crates/burn-train/src/metric/precision.rs Show resolved Hide resolved
crates/burn-train/src/metric/precision.rs Outdated Show resolved Hide resolved
Tiago Sanona added 5 commits December 8, 2024 19:24
# Conflicts:
#	crates/burn-train/src/learner/classification.rs
#	crates/burn-train/src/metric/confusion_stats.rs
Copy link

codecov bot commented Dec 8, 2024

Codecov Report

Attention: Patch coverage is 89.65517% with 15 lines in your changes missing coverage. Please review.

Project coverage is 81.84%. Comparing base (60f70cf) to head (ee06887).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
crates/burn-train/src/metric/recall.rs 88.88% 7 Missing ⚠️
crates/burn-train/src/learner/classification.rs 0.00% 5 Missing ⚠️
crates/burn-train/src/metric/confusion_stats.rs 93.18% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2518   +/-   ##
=======================================
  Coverage   81.83%   81.84%           
=======================================
  Files         836      838    +2     
  Lines      107214   107302   +88     
=======================================
+ Hits        87743    87821   +78     
- Misses      19471    19481   +10     

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

Copy link
Member

@laggui laggui left a comment

Choose a reason for hiding this comment

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

Ok I think we're converging 😄

Just some changes regarding the config but otherwise I think it will be good to go after.

crates/burn-train/src/metric/classification.rs Outdated Show resolved Hide resolved
crates/burn-train/src/metric/precision.rs Show resolved Hide resolved
@tsanona tsanona requested a review from laggui December 11, 2024 15:33
Copy link
Member

@laggui laggui left a comment

Choose a reason for hiding this comment

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

LGTM! Just missing a tiny bit of doc for the decision rule.

Comment on lines 10 to 14
/// The prediction decision rule for classification metrics.
pub enum DecisionRule {
Threshold(f64),
TopK(NonZeroUsize),
}
Copy link
Member

Choose a reason for hiding this comment

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

Ok! I think I've come around to the terminology behind this representation.

Just make sure to document both decision rules. Suggestions:

Top-k: Consider the prediction correct if the true label is within the top k predicted classes based on scores.
Threshold: Consider a class predicted if its probability exceeds the threshold.

Copy link
Contributor Author

@tsanona tsanona Dec 19, 2024

Choose a reason for hiding this comment

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

Great, I'm glad! Thanks for the tip and suggestions. I changed TopK's slightly. Let me know what you think.

Copy link
Member

@laggui laggui left a comment

Choose a reason for hiding this comment

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

Let's go 🚀

@laggui laggui merged commit 676877a into tracel-ai:main Dec 20, 2024
11 checks passed
@tsanona tsanona deleted the add-recall branch December 21, 2024 04:22
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.

2 participants