Prechádzať zdrojové kódy

Merge branch 'feature_2023062711_liqian_add_ad_abtest' into test

liqian 1 rok pred
rodič
commit
c806e6d42f
3 zmenil súbory, kde vykonal 50 pridanie a 15 odobranie
  1. 32 0
      config.py
  2. 13 10
      video_rank.py
  3. 5 5
      video_recall.py

+ 32 - 0
config.py

@@ -919,6 +919,14 @@ class BaseConfig(object):
             'group_class_key': 'class1',
             'no_ad_mid_group_list': NO_AD_MID_GROUP_LIST['class1']
         },  # 所有广告类型本端视频数据 + 优化1
+        '190-f': {
+            'video': {'data': 'videos21'},
+            'user': {'data': 'user21', 'rule': 'rule2'},
+            'group_class_key': 'class1',
+            'no_ad_mid_group_list': NO_AD_MID_GROUP_LIST['class1'],
+            'care_model_status_param': 1,
+            'care_model_ab_mid_group': 'mean_group',
+        },  # 所有广告类型本端视频数据 + 优化1 + 未开启关怀模式人群多出广告
 
         # 票圈视频
         '194-a': {
@@ -1045,6 +1053,14 @@ class BaseConfig(object):
             'group_class_key': 'class1',
             'no_ad_mid_group_list': NO_AD_MID_GROUP_LIST['class1']
         },  # 所有广告类型本端数据
+        '196-f': {
+            'video': {'data': 'videos6'},
+            'user': {'data': 'user6', 'rule': 'rule1'},
+            'group_class_key': 'class1',
+            'no_ad_mid_group_list': NO_AD_MID_GROUP_LIST['class1'],
+            'care_model_status_param': 1,
+            'care_model_ab_mid_group': 'mean_group',
+        },  # 所有广告类型本端数据 + else非关怀模式人群多出广告
 
         # 老好看视频
         '197-a': {
@@ -1129,6 +1145,14 @@ class BaseConfig(object):
             'group_class_key': 'class1',
             'no_ad_mid_group_list': NO_AD_MID_GROUP_LIST['class1']
         },  # 所有广告类型本端数据 + 优化阈值计算方式
+        '242-d': {
+            'video': {'data': 'videos22'},
+            'user': {'data': 'user22', 'rule': 'rule2'},
+            'group_class_key': 'class1',
+            'no_ad_mid_group_list': NO_AD_MID_GROUP_LIST['class1'],
+            'care_model_status_param': 1,
+            'care_model_ab_mid_group': 'mean_group',
+        },  # 所有广告类型本端数据 + 优化阈值计算方式 + else非关怀模式人群多出广告
 
         # 票圈福年
         '243-a': {
@@ -1149,6 +1173,14 @@ class BaseConfig(object):
             'group_class_key': 'class1',
             'no_ad_mid_group_list': NO_AD_MID_GROUP_LIST['class1']
         },  # 所有广告类型本端数据
+        '243-d': {
+            'video': {'data': 'videos3'},
+            'user': {'data': 'user3', 'rule': 'rule1'},
+            'group_class_key': 'class1',
+            'no_ad_mid_group_list': NO_AD_MID_GROUP_LIST['class1'],
+            'care_model_status_param': 1,
+            'care_model_ab_mid_group': 'mean_group',
+        },  # 所有广告类型本端数据 + else非关怀模式人群多出广告
 
         # 票圈|信仰之路
         '324-a': {

+ 13 - 10
video_rank.py

@@ -945,14 +945,14 @@ def video_sank_pos_rank(data, size, top_K, flow_pool_P, ab_Code='', exp_config=N
         else:
             recall_dict['return_video_recall'] = return_video_recall
 
-    recall_pos1 = [('rov_recall_region_h',0.98),('rov_recall_24h',0.02),('rov_recall_region_24h',1),
-                   ('rov_recall_24h',1),('rov_recall_24h_dup',1)]
-    recall_pos2 =  [('rov_recall_region_h',0.98),('rov_recall_24h',0.02),('rov_recall_region_24h',1),
-                   ('rov_recall_24h',1),('rov_recall_24h_dup',1)]
-    recall_pos3 = [('rov_recall_region_h', 0.98), ('rov_recall_24h', 0.02), ('rov_recall_region_24h', 1),
-                   ('rov_recall_24h', 1), ('rov_recall_24h_dup', 1)]
-    recall_pos4 = [('rov_recall_region_h', 0.98), ('rov_recall_24h', 0.02), ('rov_recall_region_24h', 1),
-                   ('rov_recall_24h', 1), ('rov_recall_24h_dup', 1)]
+    recall_pos1 = [('rov_recall_region_h',0, 0.98),('rov_recall_24h',0.98, 1),('rov_recall_region_24h',0,1),
+                   ('rov_recall_24h',0,1), ('rov_recall_24h_dup',0,1)]
+    recall_pos2 =  [('rov_recall_region_h',0,0.98),('rov_recall_24h',0.98,1),('rov_recall_region_24h',0,1),
+                   ('rov_recall_24h',0,1),('rov_recall_24h_dup',0,1)]
+    recall_pos3 = [('rov_recall_region_h', 0,0.98), ('rov_recall_24h', 0.98,1), ('rov_recall_region_24h', 0,1),
+                   ('rov_recall_24h', 0,1), ('rov_recall_24h_dup', 0,1)]
+    recall_pos4 = [('rov_recall_region_h', 0,0.98), ('rov_recall_24h', 0,0.02), ('rov_recall_region_24h', 0,1),
+                   ('rov_recall_24h', 0,1), ('rov_recall_24h_dup', 0,1)]
     if exp_config  and 'recall_pos1' in exp_config \
             and 'recall_pos2' in exp_config \
             and 'recall_pos3' in exp_config \
@@ -985,14 +985,17 @@ def video_sank_pos_rank(data, size, top_K, flow_pool_P, ab_Code='', exp_config=N
             for per_recall_item in recall_pos_config:
                 if index_pos == 1:
                     break
+                if len(per_recall_item)<3:
+                    continue
                 per_recall_name = per_recall_item[0]
-                per_recall_freq = per_recall_item[1]
+                per_recall_min = float(per_recall_item[1])
+                per_recall_max = float(per_recall_item[2])
                 per_recall_num = exp_recall_dict.get(per_recall_name, 0)
                 per_recall_total_num = recall_num_limit_dict.get(per_recall_name, 0)
                 # recall set total num
                 if len(recall_num_limit_dict)>0 and per_recall_total_num>0 and per_recall_num>= per_recall_total_num:
                     continue
-                if rand_num < per_recall_freq and per_recall_name in recall_dict:
+                if rand_num >= per_recall_min and rand_num < per_recall_max and per_recall_name in recall_dict:
                     per_recall = recall_dict[per_recall_name]
                     for recall_item in per_recall:
                         vid = recall_item['videoId']

+ 5 - 5
video_recall.py

@@ -2585,7 +2585,7 @@ class PoolRecall(object):
             return None
 
     def get_w2v_config(self):
-        recall_key = "w2v_exp_config_pos"
+        recall_key = "w2v_exp_config_pos_range"
         data = self.redis_helper.get_data_from_redis(key_name=recall_key)
         if data is not None:
             try:
@@ -2614,7 +2614,7 @@ class PoolRecall(object):
             return None
 
     def get_simrecall_config_new(self):
-        recall_key = "simrecall_exp_config_pos_new"
+        recall_key = "simrecall_exp_config_range"
         #print("recall_key:", recall_key)
         data = self.redis_helper.get_data_from_redis(key_name=recall_key)
         if data is not None:
@@ -2643,7 +2643,7 @@ class PoolRecall(object):
             return None
 
     def get_U2I_config(self):
-        recall_key = "u2i_exp_config_pos"
+        recall_key = "u2i_exp_config_pos_range"
         data = self.redis_helper.get_data_from_redis(key_name=recall_key)
         if data is not None:
             try:
@@ -2657,7 +2657,7 @@ class PoolRecall(object):
             return None
 
     def get_u2u2i_config(self):
-        recall_key = "u2u2i_exp_config"
+        recall_key = "u2u2i_exp_config_range"
         data = self.redis_helper.get_data_from_redis(key_name=recall_key)
         if data is not None:
             try:
@@ -2828,7 +2828,7 @@ class PoolRecall(object):
         return recall_result
 
     def get_video_recall_config(self):
-        recall_key = "vr_exp_pos_config"
+        recall_key = "vr_exp_pos_config_range"
         data = self.redis_helper.get_data_from_redis(key_name=recall_key)
         if data is not None:
             try: