MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / PlattCalibrator

Class PlattCalibrator

uncommon_route/decision/calibration.py:12–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10
11@dataclass
12class PlattCalibrator:
13 temperature: float = 1.0
14
15 def calibrate(self, raw_confidence: float) -> float:
16 safe = max(1e-6, min(1.0 - 1e-6, raw_confidence))
17 logit = math.log(safe / (1.0 - safe))
18 scaled = logit / max(0.05, self.temperature)
19 return 1.0 / (1.0 + math.exp(-scaled))
20
21
22def fit_platt_from_evals(

Callers 6

fit_platt_from_evalsFunction · 0.85
_compute_eceFunction · 0.85
load_calibratorFunction · 0.85

Calls

no outgoing calls