DawnC commited on
Commit
2293434
1 Parent(s): dbb9e38

Update scoring_calculation_system.py

Browse files
Files changed (1) hide show
  1. scoring_calculation_system.py +9 -12
scoring_calculation_system.py CHANGED
@@ -557,12 +557,7 @@ def calculate_compatibility_score(breed_info: dict, user_prefs: UserPreferences)
557
 
558
  def amplify_score(score):
559
  """
560
- 優化分數放大函數,產生更自然的分數分布
561
-
562
- 改進:
563
- - 使用更自然的指數關係
564
- - 加入細微的隨機變化
565
- - 避免過多的整數和半數
566
  """
567
  # 基礎調整
568
  adjusted = (score - 0.35) * 1.8
@@ -574,14 +569,16 @@ def calculate_compatibility_score(breed_info: dict, user_prefs: UserPreferences)
574
  import random
575
  random_adjustment = random.uniform(-0.003, 0.003)
576
 
577
- # 特別處理高分區間,使其更分散
578
- if amplified > 0.95:
579
- amplified = 0.95 + (amplified - 0.95) * 0.6
 
580
 
581
- final_score = max(0.55, min(0.98, amplified + random_adjustment))
 
582
 
583
- # 避免過多的 .0 和 .5 結尾
584
- return round(final_score + random.uniform(-0.001, 0.001), 3)
585
 
586
  final_score = amplify_score(weighted_score)
587
 
 
557
 
558
  def amplify_score(score):
559
  """
560
+ 優化分數放大函數,確保分數範圍合理
 
 
 
 
 
561
  """
562
  # 基礎調整
563
  adjusted = (score - 0.35) * 1.8
 
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