Просмотр исходного кода

fix: 对齐 RankStrategyBy900 校准调用到 getCopcWithLayer

ModelUserLayerDataHelper 已移除旧 getCopc,900 同步使用新 API。

Co-authored-by: Cursor <cursoragent@cursor.com>
xueyiming 1 день назад
Родитель
Сommit
0968e7a3cf

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

@@ -1153,32 +1153,39 @@ public class RankStrategyBy900 extends RankStrategyBasic {
 
             try {
                 String customerId = String.valueOf(item.getCustomerId());
+                String agentId = String.valueOf(item.getAgentId());
                 String landingPageType =
                         String.valueOf(item.getLandingPageType());
 
-                Double copc = ModelUserLayerDataHelper.getCopc(
+                ModelUserLayerDataHelper.CalibrationData calibData = ModelUserLayerDataHelper.getCopcWithLayer(
                         modelName,
                         landingPageType,
                         item.getTargetingConversion(),
                         layer,
                         item.getProfession(),
+                        agentId,
                         customerId
                 );
 
-                if (copc == null || copc.isNaN() || copc.isInfinite()) {
+                if (calibData == null || calibData.getCopc() == null
+                        || calibData.getCopc().isNaN() || calibData.getCopc().isInfinite()) {
                     continue;
                 }
-
-                copc = Math.max(0.01d, Math.min(copc, 5.0d));
-
                 if (item.getScoreMap() == null) {
                     continue;
                 }
 
-                double score = item.getLrScore() * copc;
+                Double copc = calibData.getCopc();
+                item.getExt().put("modelCtcvrCalibrationLayer", calibData.getLayer());
+                item.getExt().put("modelCtcvrCalibrationData", JSONObject.toJSONString(calibData));
+                item.getScoreMap().put("modelCtcvrCalibrationPrimitiveCopc", copc);
+                // 校准系数 = (1 + copc) / 2,最终截断到 [0.3, 3]
+                double coefficient = Math.max(0.3d, Math.min((1.0d + copc) / 2.0d, 3.0d));
+
+                double score = item.getLrScore() * coefficient;
 
                 item.getScoreMap().put("modelCtcvrCalibrationScore", score);
-                item.getScoreMap().put("modelCtcvrCalibrationCopc", copc);
+                item.getScoreMap().put("modelCtcvrCalibrationUseCopc", coefficient);
                 item.getScoreMap().put("ctcvrScore", score);
                 item.setLrScore(score);
             } catch (Exception e) {