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

Fix num_classes arg in F1 metric #5663

Merged
merged 6 commits into from
Jan 27, 2021

Conversation

SkafteNicki
Copy link
Member

@SkafteNicki SkafteNicki commented Jan 26, 2021

What does this PR do?

Fixes #5662
Removes default for num_classes arg in F1 metric, as not setting it correctly can lead to strange results.
Furthermore make sure F1 is actually tested and not just FBeta metric with beta=1.0.
cc: @teddykoker

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified
  • Check that target branch and milestone match!

Did you have fun?

Make sure you had fun coding 🙃

@SkafteNicki SkafteNicki added bug Something isn't working Metrics labels Jan 26, 2021
@SkafteNicki SkafteNicki added this to the 1.1.x milestone Jan 26, 2021
Copy link
Contributor

@teddykoker teddykoker left a comment

Choose a reason for hiding this comment

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

Perfect, can we get this in the next release?

@SkafteNicki SkafteNicki mentioned this pull request Jan 26, 2021
@codecov
Copy link

codecov bot commented Jan 26, 2021

Codecov Report

Merging #5663 (19815d7) into master (d2aaa39) will not change coverage.
The diff coverage is n/a.

@@          Coverage Diff           @@
##           master   #5663   +/-   ##
======================================
  Coverage      93%     93%           
======================================
  Files         135     135           
  Lines       10051   10051           
======================================
  Hits         9383    9383           
  Misses        668     668           

pytorch_lightning/metrics/classification/f_beta.py Outdated Show resolved Hide resolved
tests/metrics/classification/test_f_beta.py Outdated Show resolved Hide resolved
tests/metrics/classification/test_f_beta.py Outdated Show resolved Hide resolved
@Borda Borda added the ready PRs ready to be merged label Jan 27, 2021
@mergify mergify bot requested a review from a team January 27, 2021 00:10
Copy link
Contributor

@s-rog s-rog 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 get Borda's comments!

@Borda Borda enabled auto-merge (squash) January 27, 2021 08:03
@Borda Borda merged commit 84e02fb into Lightning-AI:master Jan 27, 2021
tchaton pushed a commit that referenced this pull request Feb 5, 2021
* fix f1 metric

* Apply suggestions from code review

* chlog

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Jirka Borovec <[email protected]>
Co-authored-by: Jirka Borovec <[email protected]>
Borda added a commit that referenced this pull request Feb 5, 2021
* fix f1 metric

* Apply suggestions from code review

* chlog

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Jirka Borovec <[email protected]>
Co-authored-by: Jirka Borovec <[email protected]>
@SkafteNicki SkafteNicki deleted the metrics/f_beta_num_classes_fix branch March 2, 2021 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

F1 score > 1
5 participants