aboutsummaryrefslogtreecommitdiff
path: root/core/scoring.go
blob: 66b3a3b8be6301fb5ed5f9502d1f7e4a5c1fff68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Vendored from scholscan/core/scoring.go (rev 7c1a5ef, 2026-08-28).
// Owned here; no upstream sync.
// Score conversion utilities.
//
// ScoreToScale: Maps probability (0-1) to user-friendly 1-10 scale.
// Why: Users understand "8/10" better than "0.82 probability".
package core

import "math"

// ScoreToScale turns probability into 1-10 display score
func ScoreToScale(rawScore, threshold float64) int {
	k := 10.0
	adjustedScore := 1.0 / (1.0 + math.Exp(-k*(rawScore-threshold)))
	return int(math.Round(1.0 + (adjustedScore * 9.0)))
}