瀏覽代碼

feat:修改680实验

zhaohaipeng 9 月之前
父節點
當前提交
d313bbb242

+ 5 - 4
ad-engine-commons/src/main/java/com/tzld/piaoquan/ad/engine/commons/util/NumUtil.java

@@ -9,11 +9,12 @@ public class NumUtil {
         return d1 / d2;
     }
 
-    public static double log(double a) {
-        if (a <= 0) {
-            return 0;
+
+    public static Double log(double a){
+        if (a <= 0){
+            return 0D;
         }
-        return Math.log(a);
+        return Math.log(a + 1.0);
     }
 
     @SafeVarargs

+ 1 - 1
ad-engine-server/src/main/resources/ad_score_config_20240626.conf

@@ -2,7 +2,7 @@ scorer-config = {
   lr-rov-score-config = {
     scorer-name = "com.tzld.piaoquan.ad.engine.service.score.VlogRovLRScorer"
     scorer-priority = 99
-    model-path = "zhangbo/model_bkb0.txt"
+    model-path = "zhangbo/model_bkb8_v3.txt"
   }
 
 }

+ 1 - 1
ad-engine-server/src/main/resources/application-dev.yml

@@ -4,7 +4,7 @@ server:
 eureka:
   client:
     serviceUrl:
-      defaultZone: http://deveureka-internal.piaoquantv.com/eureka/
+      defaultZone: http://preeureka-internal.piaoquantv.com/eureka/
 
 datalog: .
 

+ 10 - 10
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/RankService680.java

@@ -184,19 +184,19 @@ public class RankService680 {
     }
 
     private void handleB1Feature(Map<String, String> b1Feature, Map<String, String> cidFeatureMap, String cid) {
-        cidFeatureMap.put("cid_" + cid, "1");
-        if (StringUtils.isNotBlank(b1Feature.get("adid"))) {
-            String adId = b1Feature.get("adid");
-            cidFeatureMap.put("adid_" + adId, idDefaultValue);
-        }
+        cidFeatureMap.put("cid_" + cid, "0.01");
+        // if (StringUtils.isNotBlank(b1Feature.get("adid"))) {
+        //     String adId = b1Feature.get("adid");
+        //     cidFeatureMap.put("adid_" + adId, idDefaultValue);
+        // }
         if (StringUtils.isNotBlank(b1Feature.get("adverid"))) {
             String adVerId = b1Feature.get("adverid");
-            cidFeatureMap.put("adverid_" + adVerId, idDefaultValue);
-        }
-        if (StringUtils.isNotBlank(b1Feature.get("targeting_conversion"))) {
-            String targetingConversion = b1Feature.get("targeting_conversion");
-            cidFeatureMap.put("targeting_conversion_" + targetingConversion, idDefaultValue);
+            cidFeatureMap.put("adverid_" + adVerId, "0.01");
         }
+        // if (StringUtils.isNotBlank(b1Feature.get("targeting_conversion"))) {
+        //     String targetingConversion = b1Feature.get("targeting_conversion");
+        //     cidFeatureMap.put("targeting_conversion_" + targetingConversion, idDefaultValue);
+        // }
         if (StringUtils.isNotBlank(b1Feature.get("cpa"))) {
             String cpa = b1Feature.get("cpa");
             cidFeatureMap.put("cpa", cpa);

+ 22 - 25
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/VlogRovFMScorer.java

@@ -8,14 +8,12 @@ import com.tzld.piaoquan.ad.engine.commons.score.model.FMModel;
 import com.tzld.piaoquan.recommend.feature.domain.ad.base.AdRankItem;
 import com.tzld.piaoquan.recommend.feature.domain.ad.base.UserAdFeature;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang.exception.ExceptionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.*;
 
 
@@ -132,29 +130,28 @@ public class VlogRovFMScorer extends BaseFMModelScorer {
                             final Map<String, String> sceneFeatureMap) {
 
 
-        // Map<String, String> featureMap = new HashMap<>();
-        // if (MapUtils.isNotEmpty(item.getFeatureMap())) {
-        //     featureMap.putAll(item.getFeatureMap());
-        // }
-        // if (MapUtils.isNotEmpty(userFeatureMap)) {
-        //     featureMap.putAll(userFeatureMap);
-        // }
-        // if (MapUtils.isNotEmpty(sceneFeatureMap)) {
-        //     featureMap.putAll(sceneFeatureMap);
-        // }
+        Map<String, String> featureMap = new HashMap<>();
+        if (MapUtils.isNotEmpty(item.getFeatureMap())) {
+            featureMap.putAll(item.getFeatureMap());
+        }
+        if (MapUtils.isNotEmpty(userFeatureMap)) {
+            featureMap.putAll(userFeatureMap);
+        }
+        if (MapUtils.isNotEmpty(sceneFeatureMap)) {
+            featureMap.putAll(sceneFeatureMap);
+        }
 
         double pro = 0.0;
-        // if (MapUtils.isNotEmpty(featureMap)) {
-        //     try {
-        //         pro = model.score(featureMap);
-        //         // LOGGER.info("fea : {}, score:{}", JSONUtils.toJson(featureMap), pro);
-        //     } catch (Exception e) {
-        //         LOGGER.error("score error for doc={} exception={}", item.getVideoId(), ExceptionUtils.getFullStackTrace(e));
-        //     }
-        // }
-        // item.setScoreRov(pro);
-        // item.getScoresMap().put("RovFMScore", pro);
-        // item.setAllFeatureMap(featureMap);
+        if (MapUtils.isNotEmpty(featureMap)) {
+            try {
+                pro = model.score(featureMap);
+                // LOGGER.info("fea : {}, score:{}", JSONUtils.toJson(featureMap), pro);
+            } catch (Exception e) {
+                LOGGER.error("score error for doc={} exception={}", item.getVideoId(), ExceptionUtils.getFullStackTrace(e));
+            }
+        }
+        item.setLrScore(pro);
+        item.getScoreMap().put("ctcvrScore", pro);
         return pro;
     }
 }

+ 1 - 1
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/VlogRovLRScorer.java

@@ -148,7 +148,7 @@ public class VlogRovLRScorer extends BaseLRV2ModelScorer {
                 LOGGER.error("score error for doc={} exception={}", item.getVideoId(), ExceptionUtils.getFullStackTrace(e));
             }
         }
-        item.getScoreMap().put("rovLrScore", pro);
+        item.getScoreMap().put("ctcvrScore", pro);
         item.setLrScore(pro);
         return pro;
     }