Spaces:
Runtime error
Runtime error
update
Browse files
src/similarity_model/hybrid_ranker.py
CHANGED
|
@@ -134,20 +134,24 @@ def compute_originality(
|
|
| 134 |
) -> float:
|
| 135 |
"""
|
| 136 |
Originality Score (0-100)
|
| 137 |
-
|
| 138 |
-
- Driven strictly by inverse of hybrid similarity (non-linear).
|
| 139 |
"""
|
| 140 |
-
|
| 141 |
hybrid_score = clamp(hybrid_score)
|
| 142 |
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
|
| 152 |
|
| 153 |
def compute_confidence(
|
|
|
|
| 134 |
) -> float:
|
| 135 |
"""
|
| 136 |
Originality Score (0-100)
|
| 137 |
+
Calibrated piecewise curve to match human perception of similarity.
|
|
|
|
| 138 |
"""
|
|
|
|
| 139 |
hybrid_score = clamp(hybrid_score)
|
| 140 |
|
| 141 |
+
if hybrid_score >= 0.39:
|
| 142 |
+
# > 0.39 is a strong semantic match -> Originality 0-25%
|
| 143 |
+
originality = 25.0 - ((hybrid_score - 0.39) / 0.11) * 25.0
|
| 144 |
+
elif hybrid_score >= 0.35:
|
| 145 |
+
# 0.35 to 0.39 is a moderate match -> Originality 25-75%
|
| 146 |
+
originality = 75.0 - ((hybrid_score - 0.35) / 0.04) * 50.0
|
| 147 |
+
elif hybrid_score >= 0.25:
|
| 148 |
+
# 0.25 to 0.35 is a weak match -> Originality 75-95%
|
| 149 |
+
originality = 95.0 - ((hybrid_score - 0.25) / 0.10) * 20.0
|
| 150 |
+
else:
|
| 151 |
+
# < 0.25 is effectively unrelated -> Originality 95-100%
|
| 152 |
+
originality = 100.0 - (hybrid_score / 0.25) * 5.0
|
| 153 |
+
|
| 154 |
+
return round(clamp(originality), 2)
|
| 155 |
|
| 156 |
|
| 157 |
def compute_confidence(
|