DawnC commited on
Commit
6e2b666
1 Parent(s): 51398a5

Update scoring_calculation_system.py

Browse files
Files changed (1) hide show
  1. scoring_calculation_system.py +6 -10
scoring_calculation_system.py CHANGED
@@ -557,7 +557,7 @@ def calculate_compatibility_score(breed_info: dict, user_prefs: UserPreferences)
557
 
558
  def amplify_score(score):
559
  """
560
- 優化分數放大函數,確保分數範圍合理
561
  """
562
  # 基礎調整
563
  adjusted = (score - 0.35) * 1.8
@@ -565,20 +565,16 @@ def calculate_compatibility_score(breed_info: dict, user_prefs: UserPreferences)
565
  # 使用 3.2 次方使曲線更平滑
566
  amplified = pow(adjusted, 3.2) / 5.8 + score
567
 
568
- # 加入細微的隨機變化(約±0.3%)
569
- import random
570
- random_adjustment = random.uniform(-0.003, 0.003)
571
-
572
  # 特別處理高分區間,確保不超過95%
573
  if amplified > 0.90:
574
  # 壓縮高分區間,確保最高到95%
575
- amplified = 0.90 + (min(0.95, amplified) - 0.90) * 0.5
576
 
577
- # 確保最終分數在合理範圍內
578
- final_score = max(0.55, min(0.95, amplified + random_adjustment))
579
 
580
- # 確保不超過95%
581
- return min(0.95, round(final_score + random.uniform(-0.001, 0.001), 3))
582
 
583
  final_score = amplify_score(weighted_score)
584
 
 
557
 
558
  def amplify_score(score):
559
  """
560
+ 優化分數放大函數,確保分數範圍合理且結果一致
561
  """
562
  # 基礎調整
563
  adjusted = (score - 0.35) * 1.8
 
565
  # 使用 3.2 次方使曲線更平滑
566
  amplified = pow(adjusted, 3.2) / 5.8 + score
567
 
 
 
 
 
568
  # 特別處理高分區間,確保不超過95%
569
  if amplified > 0.90:
570
  # 壓縮高分區間,確保最高到95%
571
+ amplified = 0.90 + (amplified - 0.90) * 0.5
572
 
573
+ # 確保最終分數在合理範圍內(0.55-0.95)
574
+ final_score = max(0.55, min(0.95, amplified))
575
 
576
+ # 四捨五入到小數點後第三位
577
+ return round(final_score, 3)
578
 
579
  final_score = amplify_score(weighted_score)
580