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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add recall #2518

wants to merge 3 commits into from

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! 🙂

pub enum ClassificationConfig {
Binary {
threshold: f64,
class_reduction: ClassReduction,
Copy link
Member

Choose a reason for hiding this comment

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

I think I would leave the class reduction out of the config. It is mandatory for all classification types based on the metric anyway, and it's weird that the same field is repeated.

}
}

pub enum ClassificationConfig {
Copy link
Member

Choose a reason for hiding this comment

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

The name might be a little too generic. I suggest ClassificationMetricConfig.


/// Input for classification metrics
#[derive(new, Debug, Clone)]
pub struct ClassificationInput<B: Backend> {
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit too broad since we have other classification metrics already. Since this is relevant to the confusion statistics computed, I suggest that it is renamed to something like ConfusionStatsInput.

Lmk what you think.

Comment on lines -98 to -104
/// Sets the class reduction method.
#[allow(dead_code)]
pub fn with_class_reduction(mut self, class_reduction: ClassReduction) -> Self {
self.class_reduction = class_reduction;
self
}

Copy link
Member

Choose a reason for hiding this comment

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

With the suggested change to remove class reduction from the config, I would keep this.

Comment on lines 19 to +20
class_reduction: ClassReduction,
config: PrecisionConfig,
config: ClassificationConfig,
Copy link
Member

Choose a reason for hiding this comment

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

You forgot the separate class_reduction field. But anyway with the suggested change it would remain 🙂

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