(ranking) Suppress NaN:s in ranking output

This commit is contained in:
Viktor Lofgren 2024-04-19 13:58:28 +02:00
parent f4a2fea451
commit f623b37577

View File

@ -124,11 +124,20 @@ public class ResultValuator {
// Renormalize to 0...15, where 0 is the best possible score; // Renormalize to 0...15, where 0 is the best possible score;
// this is a historical artifact of the original ranking function // this is a historical artifact of the original ranking function
return normalize( double ret = normalize(
tcfOverlap + tcfJaccard tcfOverlap + tcfJaccard
+ bM25F + bM25P + bM25N + bM25F + bM25P + bM25N
+ overallPartPositive, + overallPartPositive,
overallPartNegative); overallPartNegative);
if (Double.isNaN(ret)) {
if (getClass().desiredAssertionStatus()) {
throw new IllegalStateException("NaN in result value calculation");
}
return Double.MAX_VALUE;
}
return ret;
} }
private double calculateQualityPenalty(int size, int quality, ResultRankingParameters rankingParams) { private double calculateQualityPenalty(int size, int quality, ResultRankingParameters rankingParams) {