liqian 1 year ago
parent
commit
4ea7b3979d
1 changed files with 8 additions and 6 deletions
  1. 8 6
      ad_xgboost_predict.py

+ 8 - 6
ad_xgboost_predict.py

@@ -30,15 +30,17 @@ def xgboost_predict(model, app_type, mid, video_id, abtest_id, ab_test_code):
         video_feature = redis_helper.get_data_from_redis(key_name=video_feature_key)
     video_feature = eval(video_feature)
 
-    # 3. 拼接出广告时的特征 & 预测
+    # 3. 拼接出广告时的特征 & 预测
     ad_feature_0 = user_feature + video_feature + [0]
-    ad_0_predict = model.predict_proba(np.array([ad_feature_0]))
-    ad_0_predict = ad_0_predict[0][1]
+    # ad_0_predict = model.predict_proba(np.array([ad_feature_0]))
+    # ad_0_predict = ad_0_predict[0][1]
+    ad_0_predict = 0.7
 
-    # 4. 拼接出广告时的特征 & 预测
+    # 4. 拼接出广告时的特征 & 预测
     ad_feature_1 = user_feature + video_feature + [1]
-    ad_1_predict = model.predict_proba(np.array([ad_feature_1]))
-    ad_1_predict = ad_1_predict[0][1]
+    # ad_1_predict = model.predict_proba(np.array([ad_feature_1]))
+    # ad_1_predict = ad_1_predict[0][1]
+    ad_1_predict = 0.6
 
     # 5. 作差
     predict_res = ad_0_predict - ad_1_predict