|
@@ -3,6 +3,7 @@ package com.tzld.piaoquan.ad.engine.service.score.strategy;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
|
import com.tzld.piaoquan.ad.engine.commons.dto.AdPlatformCreativeDTO;
|
|
import com.tzld.piaoquan.ad.engine.commons.dto.AdPlatformCreativeDTO;
|
|
|
|
|
+import com.tzld.piaoquan.ad.engine.commons.helper.CopcV3DataHelper;
|
|
|
import com.tzld.piaoquan.ad.engine.commons.helper.CreativeUserLayerDataHelperV2;
|
|
import com.tzld.piaoquan.ad.engine.commons.helper.CreativeUserLayerDataHelperV2;
|
|
|
import com.tzld.piaoquan.ad.engine.commons.helper.DnnCidDataHelper;
|
|
import com.tzld.piaoquan.ad.engine.commons.helper.DnnCidDataHelper;
|
|
|
import com.tzld.piaoquan.ad.engine.commons.param.RankRecommendRequestParam;
|
|
import com.tzld.piaoquan.ad.engine.commons.param.RankRecommendRequestParam;
|
|
@@ -43,7 +44,7 @@ public class RankStrategyBy865 extends RankStrategyBasic {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 空 Map 常量,避免频繁创建空 HashMap
|
|
* 空 Map 常量,避免频繁创建空 HashMap
|
|
|
- */
|
|
|
|
|
|
|
+ */
|
|
|
private static final Map<String, String> EMPTY_STRING_MAP = Collections.emptyMap();
|
|
private static final Map<String, String> EMPTY_STRING_MAP = Collections.emptyMap();
|
|
|
private static final Map<String, Map<String, String>> EMPTY_NESTED_MAP = Collections.emptyMap();
|
|
private static final Map<String, Map<String, String>> EMPTY_NESTED_MAP = Collections.emptyMap();
|
|
|
|
|
|
|
@@ -54,6 +55,9 @@ public class RankStrategyBy865 extends RankStrategyBasic {
|
|
|
@Value("${word2vec.exp:694}")
|
|
@Value("${word2vec.exp:694}")
|
|
|
private String word2vecExp;
|
|
private String word2vecExp;
|
|
|
|
|
|
|
|
|
|
+ @Value("${rank.score.copc.v3.switch:false}")
|
|
|
|
|
+ private Boolean copcV3Enabled;
|
|
|
|
|
+
|
|
|
@ApolloJsonValue("${rank.score.params.865:{}}")
|
|
@ApolloJsonValue("${rank.score.params.865:{}}")
|
|
|
private Map<String, String> paramsMap;
|
|
private Map<String, String> paramsMap;
|
|
|
|
|
|
|
@@ -190,6 +194,7 @@ public class RankStrategyBy865 extends RankStrategyBasic {
|
|
|
adRankItem.setAgentId(dto.getAgentId());
|
|
adRankItem.setAgentId(dto.getAgentId());
|
|
|
adRankItem.setProfession(dto.getProfession());
|
|
adRankItem.setProfession(dto.getProfession());
|
|
|
adRankItem.setLandingPageType(dto.getLandingPageType());
|
|
adRankItem.setLandingPageType(dto.getLandingPageType());
|
|
|
|
|
+ adRankItem.setTargetingConversion(dto.getTargetingConversion());
|
|
|
adRankItem.setRandom(random.nextInt(1000));
|
|
adRankItem.setRandom(random.nextInt(1000));
|
|
|
if (noApiAdVerIds.contains(dto.getAdVerId())) {
|
|
if (noApiAdVerIds.contains(dto.getAdVerId())) {
|
|
|
adRankItem.getExt().put("isApi", "0");
|
|
adRankItem.getExt().put("isApi", "0");
|
|
@@ -1116,19 +1121,34 @@ public class RankStrategyBy865 extends RankStrategyBasic {
|
|
|
double minVal, double maxVal) {
|
|
double minVal, double maxVal) {
|
|
|
try {
|
|
try {
|
|
|
String layer = reqFeature.get("layer_l4");
|
|
String layer = reqFeature.get("layer_l4");
|
|
|
- for (AdRankItem item : items) {
|
|
|
|
|
- String cid = String.valueOf(item.getAdId());
|
|
|
|
|
- Double diff = CreativeUserLayerDataHelperV2.getCopc(modelName, cid, layer);
|
|
|
|
|
- if (null != diff) {
|
|
|
|
|
- double newDiff = Math.min(Math.max(minVal, diff), maxVal);
|
|
|
|
|
- if (newDiff < minValid || newDiff > maxValid) {
|
|
|
|
|
- double ctcvr = item.getLrScore() * newDiff;
|
|
|
|
|
|
|
+ if (Boolean.TRUE.equals(copcV3Enabled)) {
|
|
|
|
|
+ for (AdRankItem item : items) {
|
|
|
|
|
+ Double coefficient = CopcV3DataHelper.getLandingCoefficient(item.getLrScore(),
|
|
|
|
|
+ item.getLandingPageType(), item.getTargetingConversion());
|
|
|
|
|
+// log.info("CopcV3DataHelper originScore={}, pageType={},target={},result={}",item.getLrScore(), item.getLandingPageType(),item.getTargetingConversion(),coefficient);
|
|
|
|
|
+ if (coefficient != null) {
|
|
|
|
|
+ double ctcvr = item.getLrScore() * coefficient;
|
|
|
|
|
+ item.getScoreMap().put("copcV3Coefficient", coefficient);
|
|
|
item.getScoreMap().put("cidCtcvrScore", ctcvr);
|
|
item.getScoreMap().put("cidCtcvrScore", ctcvr);
|
|
|
item.getScoreMap().put("ctcvrScore", ctcvr);
|
|
item.getScoreMap().put("ctcvrScore", ctcvr);
|
|
|
- item.getScoreMap().put("copcDiff", diff);
|
|
|
|
|
item.setLrScore(ctcvr);
|
|
item.setLrScore(ctcvr);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ }else {
|
|
|
|
|
+ for (AdRankItem item : items) {
|
|
|
|
|
+ String cid = String.valueOf(item.getAdId());
|
|
|
|
|
+ Double diff = CreativeUserLayerDataHelperV2.getCopc(modelName, cid, layer);
|
|
|
|
|
+ if (null != diff) {
|
|
|
|
|
+ double newDiff = Math.min(Math.max(minVal, diff), maxVal);
|
|
|
|
|
+ if (newDiff < minValid || newDiff > maxValid) {
|
|
|
|
|
+ double ctcvr = item.getLrScore() * newDiff;
|
|
|
|
|
+ item.getScoreMap().put("cidCtcvrScore", ctcvr);
|
|
|
|
|
+ item.getScoreMap().put("ctcvrScore", ctcvr);
|
|
|
|
|
+ item.getScoreMap().put("copcDiff", diff);
|
|
|
|
|
+ item.setLrScore(ctcvr);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.error("calibCidScore error", e);
|
|
log.error("calibCidScore error", e);
|