Переглянути джерело

Merge branch 'feature_2023112111_liqian_add_abtest' into test

liqian 1 рік тому
батько
коміт
d8deeff35c
5 змінених файлів з 9 додано та 5 видалено
  1. 1 1
      cal_24h_score.py
  2. 4 1
      cal_hour_score.py
  3. 2 1
      compose_score.py
  4. 1 1
      config.py
  5. 1 1
      region_rule_rank_h.py

+ 1 - 1
cal_24h_score.py

@@ -74,7 +74,7 @@ def cal_score(data_df):
     df['share_rate_view'] = (df['share人数'] + 1) / (df['view人数'] + 1000)
 
     # back_rate = (return+1)/(share+10)
-    df['back_rate'] = (df['回流人数'] + 1) / (df['view人数'] + 10)
+    df['back_rate'] = (df['回流人数'] + 1) / (df['share人数'] + 10)
 
     df['log_back'] = (df['回流人数'] + 1).apply(math.log)
 

+ 4 - 1
cal_hour_score.py

@@ -116,7 +116,10 @@ def cal_score(data_df):
     # score5 = share/view * (back_rate + back_rate_2h + back_rate_3h) * logback
     df['hour_score5'] = df['share_rate_view'] * (df['back_rate'] + df['back_rate_2h'] + df['back_rate_3h']) * df['log_back']
 
-    score_df = df[['videoid', 'hour_score1', 'hour_score2', 'hour_score3', 'hour_score4', 'hour_score5']]
+    # score6 = 回流/(view+5)*back_rate
+    df['hour_score6'] = df['lastonehour_return'] / (df['lastonehour_view'] + 5) * df['back_rate']
+
+    score_df = df[['videoid', 'hour_score1', 'hour_score2', 'hour_score3', 'hour_score4', 'hour_score5', 'hour_score6']]
     # print(score_df)
     return score_df
 

+ 2 - 1
compose_score.py

@@ -33,11 +33,12 @@ def cal_compose_score(score_hour_path, score_24h_path, merge_score_path):
     # score_merge_df['score5'] = score_merge_df['24h_score1'] + score_merge_df['hour_score5']
     score_merge_df['score6'] = score_merge_df['24h_score1'] * 0.2 + score_merge_df['hour_score4'] * 0.8
     score_merge_df['score7'] = score_merge_df['24h_score2'] + score_merge_df['hour_score4']
+    score_merge_df['score8'] = score_merge_df['24h_score1'] + score_merge_df['hour_score6']
 
     # print(score_merge_df)
     log_.info(f"score_merge_df shape: {score_merge_df.shape}")
     score_merge_df.to_csv(merge_score_path, index=False)
-    score_df = score_merge_df[['videoid', 'score1', 'score4', 'score6', 'score7']]
+    score_df = score_merge_df[['videoid', 'score1', 'score4', 'score6', 'score7', 'score8']]
     log_.info(f"score_df shape: {score_merge_df.shape}")
     return score_df
 

+ 1 - 1
config.py

@@ -438,7 +438,7 @@ class BaseConfig(object):
             'rule27': {'view_type': 'video-show-region', 'platform_return_rate': 0.001,
                        'region_24h_rule_key': 'rule4', '24h_rule_key': 'rule4', 'merge_func': 2,
                        'score_func': 'back_rate_exponential_weighting1'},
-            # score = sharerate ^ 0.5 * backrate ^ 0.8 * LOG(lastonehour_return + 1) * K2 ^ 0.5
+            # score = sharerate ^ 0.5 * backrate ^ 2 * LOG(lastonehour_return + 1) * K2 ^ 0.5
             # sharerate = lastonehour_share / (lastonehour_play + 1000)
             # backrate = lastonehour_return / (lastonehour_share + 10)
             # ctr = lastonehour_play / (lastonehour_show + 1000), 对ctr限最大值:K2 = 0.6 if ctr > 0.6 else ctr

+ 1 - 1
region_rule_rank_h.py

@@ -418,7 +418,7 @@ def cal_score_with_back_rate_exponential_weighting2(df, param):
     :param param: 规则参数
     :return:
     """
-    # score计算公式: score = sharerate ^ 0.5 * backrate ^ 0.8 * LOG(lastonehour_return + 1) * K2 ^ 0.5
+    # score计算公式: score = sharerate ^ 0.5 * backrate ^ 2 * LOG(lastonehour_return + 1) * K2 ^ 0.5
     # sharerate = lastonehour_share / (lastonehour_play + 1000)
     # backrate = lastonehour_return / (lastonehour_share + 10)
     # ctr = lastonehour_play / (lastonehour_show + 1000), 对ctr限最大值:K2 = 0.6 if ctr > 0.6 else ctr