jch 1 неделя назад
Родитель
Сommit
f56021fca2

+ 11 - 14
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/strategy/RankStrategyBasic.java

@@ -14,7 +14,10 @@ import com.tzld.piaoquan.ad.engine.commons.redis.AdRedisHelper;
 import com.tzld.piaoquan.ad.engine.commons.redis.AlgorithmRedisHelper;
 import com.tzld.piaoquan.ad.engine.commons.score.ScoreParam;
 import com.tzld.piaoquan.ad.engine.commons.thread.ThreadPoolFactory;
-import com.tzld.piaoquan.ad.engine.commons.util.*;
+import com.tzld.piaoquan.ad.engine.commons.util.DateUtils;
+import com.tzld.piaoquan.ad.engine.commons.util.ObjUtil;
+import com.tzld.piaoquan.ad.engine.commons.util.RootSessionIdExpConfig;
+import com.tzld.piaoquan.ad.engine.commons.util.RootSessionIdTailUtil;
 import com.tzld.piaoquan.ad.engine.service.entity.*;
 import com.tzld.piaoquan.ad.engine.service.feature.Feature;
 import com.tzld.piaoquan.ad.engine.service.feature.FeatureService;
@@ -59,8 +62,8 @@ public abstract class RankStrategyBasic implements RankStrategy {
     @ApolloJsonValue("${h5.score.suppress.customer.white:[]}")
     private Set<Long> customerIdWhiteSet;
 
-    @ApolloJsonValue("${rank.strategy.cxr.zero.customer:{}}")
-    private Map<Long, Double> cxrZeroCustomerParams;
+    @Value("${rank.strategy.default.cxr:0.000001}")
+    protected Double defaultCxr;
 
     @Value("${guarantee.exp:742}")
     protected String guaranteeExp;
@@ -1231,21 +1234,15 @@ public abstract class RankStrategyBasic implements RankStrategy {
         return 1.0;
     }
 
-    // zero cxr
-    protected double getCustomerZeroCxr(AdRankItem item, double smoothCxr) {
+    protected double getDefaultCxr(double cxr) {
         try {
-            if (ExtractorUtils.isDoubleEqualToZero(smoothCxr)) {
-                if (!org.springframework.util.CollectionUtils.isEmpty(cxrZeroCustomerParams) && !Objects.isNull(item)) {
-                    Long customerId = item.getCustomerId();
-                    if (null != customerId && cxrZeroCustomerParams.containsKey(customerId)) {
-                        return cxrZeroCustomerParams.get(customerId);
-                    }
-                }
+            if (null != defaultCxr) {
+                return Math.max(cxr, defaultCxr);
             }
         } catch (Exception e) {
-            log.error("getZeroCxr", e);
+            log.error("cxr", e);
         }
-        return smoothCxr;
+        return cxr;
     }
 
     protected boolean landingH5Page(AdRankItem item) {

+ 4 - 1
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/strategy/RankStrategyBy847.java

@@ -329,7 +329,7 @@ public class RankStrategyBy847 extends RankStrategyBasic {
                 double view = Double.parseDouble(b3Feature.getOrDefault("ad_view_14d", "0"));
                 double conver = Double.parseDouble(b3Feature.getOrDefault("ad_conversion_14d", "0"));
                 double smoothCxr = NumUtil.divSmoothV1(conver, view, 1.64);
-                smoothCxr = this.getCustomerZeroCxr(item, smoothCxr);
+                smoothCxr = this.getDefaultCxr(smoothCxr);
                 //模型打分和统计计算取打分更低的
                 item.getScoreMap().put("cvcvrItemValue", 1.0);
                 if (smoothCxr <= calibratedScore) {
@@ -449,6 +449,9 @@ public class RankStrategyBy847 extends RankStrategyBasic {
                 top1Item.getExt().put("ecpm", ctcvrScore * top1Item.getCpa() * 1000);
                 String filterEcpmValue = paramsMap.getOrDefault("filterEcpm", filterEcpm);
                 top1Item.getExt().put("filterEcpm", filterEcpmValue);
+                if (noApiAdVerIds.contains(top1Item.getAdVerId())) {
+                    top1Item.getExt().put("ecpm", top1Item.getCpm());
+                }
             } else {
                 top1Item.getExt().put("ecpm", modelCtcvrScore * top1Item.getCpa() * 1000);
             }

+ 4 - 1
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/strategy/RankStrategyBy849.java

@@ -329,7 +329,7 @@ public class RankStrategyBy849 extends RankStrategyBasic {
                 double view = Double.parseDouble(b3Feature.getOrDefault("ad_view_14d", "0"));
                 double conver = Double.parseDouble(b3Feature.getOrDefault("ad_conversion_14d", "0"));
                 double smoothCxr = NumUtil.divSmoothV1(conver, view, 1.64);
-                smoothCxr = this.getCustomerZeroCxr(item, smoothCxr);
+                smoothCxr = this.getDefaultCxr(smoothCxr);
                 //模型打分和统计计算取打分更低的
                 item.getScoreMap().put("cvcvrItemValue", 1.0);
                 if (smoothCxr <= calibratedScore) {
@@ -448,6 +448,9 @@ public class RankStrategyBy849 extends RankStrategyBasic {
                 top1Item.getExt().put("ecpm", ctcvrScore * top1Item.getCpa() * 1000);
                 String filterEcpmValue = paramsMap.getOrDefault("filterEcpm", filterEcpm);
                 top1Item.getExt().put("filterEcpm", filterEcpmValue);
+                if (noApiAdVerIds.contains(top1Item.getAdVerId())) {
+                    top1Item.getExt().put("ecpm", top1Item.getCpm());
+                }
             } else {
                 top1Item.getExt().put("ecpm", modelCtcvrScore * top1Item.getCpa() * 1000);
             }

+ 4 - 1
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/strategy/RankStrategyBy851.java

@@ -338,7 +338,7 @@ public class RankStrategyBy851 extends RankStrategyBasic {
                 double view = Double.parseDouble(b3Feature.getOrDefault("ad_view_14d", "0"));
                 double conver = Double.parseDouble(b3Feature.getOrDefault("ad_conversion_14d", "0"));
                 double smoothCxr = NumUtil.divSmoothV1(conver, view, 1.64);
-                smoothCxr = this.getCustomerZeroCxr(item, smoothCxr);
+                smoothCxr = this.getDefaultCxr(smoothCxr);
                 //模型打分和统计计算取打分更低的
                 item.getScoreMap().put("cvcvrItemValue", 1.0);
                 if (smoothCxr <= calibratedScore) {
@@ -456,6 +456,9 @@ public class RankStrategyBy851 extends RankStrategyBasic {
                 top1Item.getExt().put("ecpm", ctcvrScore * top1Item.getCpa() * 1000);
                 String filterEcpmValue = paramsMap.getOrDefault("filterEcpm", filterEcpm);
                 top1Item.getExt().put("filterEcpm", filterEcpmValue);
+                if (noApiAdVerIds.contains(top1Item.getAdVerId())) {
+                    top1Item.getExt().put("ecpm", top1Item.getCpm());
+                }
             } else {
                 top1Item.getExt().put("ecpm", modelCtcvrScore * top1Item.getCpa() * 1000);
             }