BinaryEvaluation often results in NaN for best F1-Scores
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 352
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Description
I then printed out all F1-Scores of the ConfusionMatrices-List, which looks as expected, but has some NaN at the end. Something like
Threshold: F1-Score
0.1: 0.1
0.2: 0.2
0.4: 0.3
0.5: 0.4
0.6: 0.3
0.8: 0.2
0.9: 0.1
0.99: NaN
0.999: NaN
It should pick 0.5 as best threshold.
The problem seems that NaN are also compared, and it seems like Double.compare(SomeNumber, NaN) = -1 and Double.compare(NaN, SomeNumber) = 1. Perhaps something like this would be better:
BinaryConfusionMatrix highestF1CM = eval.getConfusionMatrices().stream().filter(x -> Double.isFinite(x.getF1Score())).max(Comparator.comparingDouble(BinaryConfusionMatrix::getF1Score)).get();
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating BinaryEvaluation and BinaryConfusionMatrix, then reproduce best-threshold selection with the reported confusion-matrix scores, including trailing NaN values. Done means the highest finite F1 score is selected rather than a NaN result; add or update coverage if an existing test location is found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100