Explorar el Código

add ad abtest config: 173-h

liqian hace 2 años
padre
commit
1368cb98ac
Se han modificado 2 ficheros con 9 adiciones y 0 borrados
  1. 5 0
      ad_user_video_predict.py
  2. 4 0
      config.py

+ 5 - 0
ad_user_video_predict.py

@@ -102,6 +102,11 @@ def predict_ad_group_video(dt, config_key, config_param, threshold_record):
             # 获取分组对应的均值作为阈值
             threshold_data[item['group']] = predict_df[item['group']].mean() * ad_threshold_mapping['group']
         threshold_data['mean_group'] = np.mean(all_group_data) * ad_threshold_mapping['mean_group']
+        # 获取需要多出广告的用户组,及阈值比例
+        more_ad = config_param.get('more_ad', None)
+        if more_ad is not None:
+            for group_key, group_threshold_rate in more_ad.items():
+                threshold_data[group_key] = threshold_data[group_key] * group_threshold_rate
         log_.info(f"config_key = {config_key}, abtest_group = {abtest_group}, threshold_data = {threshold_data}")
 
         # 将阈值写入redis

+ 4 - 0
config.py

@@ -858,6 +858,10 @@ class BaseConfig(object):
                   },
         '173-g': {'video': {'data': 'data1:7days'},
                   'user': {'data': 'data1', 'rule': 'rule2'}},
+        '173-h': {'video': {'data': 'data1'},
+                  'user': {'data': 'data1', 'rule': 'rule2'},
+                  'more_ad': {'mean_group': 0.7},
+                  },  # else人群多出广告
         # 票圈视频+
         '190-a': {'video': {'data': 'data1'},
                   'user': {'data': 'data1', 'rule': 'rule1'}},