liqian 3 years ago
parent
commit
48c6c0683a
1 changed files with 16 additions and 4 deletions
  1. 16 4
      rule_rank_h.py

+ 16 - 4
rule_rank_h.py

@@ -20,10 +20,10 @@ features = [
     'lastonehour_play',  # 过去1小时播放人数
     'lastonehour_share',  # 过去1小时分享人数
     'lastonehour_return',  # 过去1小时分享,过去1小时回流人数
-    'lastonehour_preview_total',  # 过去1小时预曝光次数
-    'lastonehour_view_total',  # 过去1小时曝光次数
-    'lastonehour_play_total',  # 过去1小时播放次数
-    'lastonehour_share_total',  # 过去1小时分享次数
+    'lastonehour_preview_total_final',  # 过去1小时预曝光次数
+    'lastonehour_view_total_final',  # 过去1小时曝光次数
+    'lastonehour_play_total_final',  # 过去1小时播放次数
+    'lastonehour_share_total_final',  # 过去1小时分享次数
 ]
 
 
@@ -111,6 +111,18 @@ def cal_score2(df):
     return df
 
 
+def cal_score3(df):
+    # score3计算公式:
+    # score = lastonehour_share_total_final/(lastonehour_view+1000)
+    # + 0.03 * lastonehour_return/(lastonehour_share_total_final+1)
+    df = df.fillna(0)
+    df['share_rate'] = df['lastonehour_share_total_final'] / (df['lastonehour_view'] + 1000)
+    df['back_rate'] = df['lastonehour_return'] / (df['lastonehour_share_total_final'] + 1)
+    df['score'] = df['share_rate'] + 0.03 * df['back_rate']
+    df = df.sort_values(by=['score'], ascending=False)
+    return df
+
+
 def video_rank(df, now_date, now_h, rule_key, param):
     """
     获取符合进入召回源条件的视频,与每日更新的rov模型结果视频列表进行合并