bat-6 commited on
Commit
35e34e4
·
1 Parent(s): df9ecf1
Files changed (1) hide show
  1. src/similarity_model/hybrid_ranker.py +15 -11
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
- # Non-linear penalty: 50% similarity drops originality slightly (to 75%),
144
- # but 90% similarity drops it massively (to 19%).
145
- originality = 1.0 - (hybrid_score ** 2)
146
-
147
- return round(
148
- max(0.0, min(100.0, originality * 100)),
149
- 2
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(