fix: use 100K reference floor for popularity normalization

When maxPop=0 (no artist has index/LB popularity data), blendedScore
returned raw relevance (0-1), making Score = MB_score directly.
Shannon Hale (MB 83, zero listens) scored 92 after tier adjustment
and ranked #4 — above Shannon Wright (MB 80, 766K real listens but
not in index).

Now blendedScore uses max(maxPop, 100K) as the normalization
denominator. With zero popularity against a 100K reference, the
60% popularity component contributes near-zero, dropping all
zero-pop artists to ~35-40. This ensures unpopular artists can't
dominate through MB text relevance alone when the index lacks data.
This commit is contained in:
2026-03-30 03:32:24 -04:00
parent 45e87b938e
commit 649e5bde9b
+7 -3
View File
@@ -1372,11 +1372,15 @@ func rerankReleaseGroups(rgs []MBReleaseGroup, pop map[string]int) {
// relevance is 01. listenCount is raw; maxListenCount is the
// maximum in the result set (for normalization).
func blendedScore(relevance float64, listenCount, maxListenCount int) float64 {
if maxListenCount <= 0 {
return relevance
// Use a floor for maxListenCount so that zero-popularity artists
// don't get a free pass when no result has popularity data.
// 100K is a reasonable "average popular artist" reference point.
effectiveMax := maxListenCount
if effectiveMax < 100_000 { //nolint:mnd
effectiveMax = 100_000
}
logPop := math.Log10(float64(listenCount)+1) / math.Log10(float64(maxListenCount)+1)
logPop := math.Log10(float64(listenCount)+1) / math.Log10(float64(effectiveMax)+1)
return relevanceWeight*relevance + popularityWeight*logPop
}