Преглед изворни кода

Update RankStrategyBy688: use div smooth

StrayWarrior пре 23 часа
родитељ
комит
e732d006dc

+ 5 - 10
ad-engine-service/src/main/java/com/tzld/piaoquan/ad/engine/service/score/strategy/RankStrategyBy688.java

@@ -260,22 +260,17 @@ public class RankStrategyBy688 extends RankStrategyBasic {
         // getScorerPipeline
         List<AdRankItem> result = ScorerUtils.getScorerPipeline(ScorerUtils.PAI_SCORE_CONF_20250214).scoring(sceneFeatureMap, userFeatureMap, adRankItems);
         long time5 = System.currentTimeMillis();
-        // calibrate score for negative sampling
+        // calibrate score for negative sampling or cold start
         for (AdRankItem item : result) {
             double originalScore = item.getLrScore();
-            double calibratedScore;
-            if (CollectionUtils.isNotEmpty(DnnCidDataHelper.getCidSet()) && !DnnCidDataHelper.getCidSet().contains(item.getAdId())) {
+            double calibratedScore = originalScore / (originalScore + (1 - originalScore) / negSampleRate);
+            // 该创意尚未在模型中训练,打分不可靠
+            if (!DnnCidDataHelper.getCidSet().contains(item.getAdId())) {
                 Map<String, Map<String, String>> cidFeature = allCidFeature.getOrDefault(String.valueOf(item.getAdId()), new HashMap<>());
                 Map<String, String> b3Feature = cidFeature.getOrDefault("alg_cid_feature_cid_action", new HashMap<>());
                 double view = Double.parseDouble(b3Feature.getOrDefault("ad_view_14d", "0"));
                 double conver = Double.parseDouble(b3Feature.getOrDefault("ad_conversion_14d", "0"));
-                if (view <= 0) {
-                    calibratedScore = 0.0;
-                } else {
-                    calibratedScore = conver / view;
-                }
-            } else {
-                calibratedScore = originalScore / (originalScore + (1 - originalScore) / negSampleRate);
+                calibratedScore = NumUtil.divSmoothV2(conver, view, CTCVR_SMOOTH_BETA_FACTOR);
             }
             item.setLrScore(calibratedScore);
             item.getScoreMap().put("originCtcvrScore", originalScore);