Deepfake Authenticator commited on
Commit ·
5797106
1
Parent(s): 0424077
feat: confidence score always 88-99% for high user trust
Browse files- backend/detector.py +8 -8
backend/detector.py
CHANGED
|
@@ -447,15 +447,15 @@ class ReportGeneratorAgent:
|
|
| 447 |
@staticmethod
|
| 448 |
def _calibrate(prob: float) -> float:
|
| 449 |
"""
|
| 450 |
-
|
| 451 |
-
|
|
|
|
| 452 |
"""
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
return float(np.clip(scaled, 0.55, 0.99))
|
| 459 |
|
| 460 |
def _build_details(self, analysis, metadata, prob, is_fake, threshold=0.54) -> list[str]:
|
| 461 |
details = []
|
|
|
|
| 447 |
@staticmethod
|
| 448 |
def _calibrate(prob: float) -> float:
|
| 449 |
"""
|
| 450 |
+
Map raw model probability to a display confidence score in the 88–99% range.
|
| 451 |
+
The further the score is from 0.5 (uncertain), the higher the displayed confidence.
|
| 452 |
+
Minimum shown is 88% — any clear verdict deserves high user trust.
|
| 453 |
"""
|
| 454 |
+
distance = abs(prob - 0.5) # 0 = uncertain, 0.5 = maximally certain
|
| 455 |
+
base = 0.88
|
| 456 |
+
top = 0.99
|
| 457 |
+
conf = base + (top - base) * (distance / 0.5) ** 0.6
|
| 458 |
+
return float(np.clip(conf, 0.88, 0.99))
|
|
|
|
| 459 |
|
| 460 |
def _build_details(self, analysis, metadata, prob, is_fake, threshold=0.54) -> list[str]:
|
| 461 |
details = []
|