Skip to content

fix: return NaN when no threshold meets min recall/precision in binary metrics#3226

Merged
Borda merged 6 commits into
Lightning-AI:masterfrom
iamkulbhushansingh:precision-recall-nan-threshold
Aug 15, 2025
Merged

fix: return NaN when no threshold meets min recall/precision in binary metrics#3226
Borda merged 6 commits into
Lightning-AI:masterfrom
iamkulbhushansingh:precision-recall-nan-threshold

Conversation

@iamkulbhushansingh

@iamkulbhushansingh iamkulbhushansingh commented Aug 13, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Replaces the hardcoded 1e6 threshold with NaN in:
    • BinaryPrecisionAtFixedRecall
    • BinaryRecallAtFixedPrecision
  • Ensures NaN is returned when no threshold satisfies the recall/precision condition.
  • Adds unit tests to validate the new behavior.

Partially Fixes #2873


Before submitting
  • Was this discussed/agreed via a GitHub issue? (not required for minor bug fixes or tests)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs? (N/A for this PR)
  • Did you write any new necessary tests?

PR review

Anyone in the community is free to review the PR once the tests have passed.
If this change was not discussed in a GitHub issue, it may take longer to review.


Did you have fun?

Yes, As always.

@Borda

Borda commented Aug 13, 2025

Copy link
Copy Markdown
Collaborator

pls add chlog entry :)

@codecov

codecov Bot commented Aug 13, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 40%. Comparing base (3a26afb) to head (70269ed).
⚠️ Report is 33 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (3a26afb) and HEAD (70269ed). Click for more details.

HEAD has 132 uploads less than BASE
Flag BASE (3a26afb) HEAD (70269ed)
torch2.8.0 3 1
macOS 7 3
cpu 49 17
python3.12 12 4
torch2.0.1+cpu 9 3
python3.10 34 12
Windows 6 2
torch2.0.1 4 2
torch2.8.0+cpu 9 3
Linux 36 12
python3.9 3 1
torch2.3.1+cpu 3 1
torch2.5.1+cpu 3 1
gpu 2 0
unittest 2 0
torch2.2.2+cpu 3 1
torch2.7.1+cpu 6 2
torch2.1.2+cpu 3 1
torch2.4.1+cpu 3 1
torch2.6.0+cpu 3 1
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #3226     +/-   ##
========================================
- Coverage      69%     40%    -28%     
========================================
  Files         364     349     -15     
  Lines       20073   19878    -195     
========================================
- Hits        13788    7991   -5797     
- Misses       6285   11887   +5602     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mergify mergify Bot added the ready label Aug 13, 2025
@Borda
Borda merged commit 58249cb into Lightning-AI:master Aug 15, 2025
64 checks passed
Borda pushed a commit that referenced this pull request Sep 3, 2025
…y metrics (#3226)

* Replace hardcoded 1e6 threshold with NaN in precision/recall fixed metrics
* fixed doc test for functional classification too
* precision fix from scientific notation to normal for CI testing

---------

Co-authored-by: Jirka Borovec <[email protected]>

(cherry picked from commit 58249cb)
Borda pushed a commit that referenced this pull request Sep 3, 2025
…y metrics (#3226)

* Replace hardcoded 1e6 threshold with NaN in precision/recall fixed metrics
* fixed doc test for functional classification too
* precision fix from scientific notation to normal for CI testing

---------

Co-authored-by: Jirka Borovec <[email protected]>

(cherry picked from commit 58249cb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Report nan in PR curve above max threshold

2 participants