|
@@ -3,7 +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.AnomalousCidDataHelper;
|
|
|
|
|
|
|
+import com.tzld.piaoquan.ad.engine.commons.helper.CreativeUserLayerDataHelper;
|
|
|
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;
|
|
|
import com.tzld.piaoquan.ad.engine.commons.score.ScoreParam;
|
|
import com.tzld.piaoquan.ad.engine.commons.score.ScoreParam;
|
|
@@ -343,6 +343,12 @@ public class RankStrategyBy847 extends RankStrategyBasic {
|
|
|
|
|
|
|
|
String calibModelName = paramsMap.getOrDefault("calibModelName", "dnnV3");
|
|
String calibModelName = paramsMap.getOrDefault("calibModelName", "dnnV3");
|
|
|
calculateCtcvrScore(result, request, scoreParam, calibModelName, reqFeature);
|
|
calculateCtcvrScore(result, request, scoreParam, calibModelName, reqFeature);
|
|
|
|
|
+
|
|
|
|
|
+ double minValidCopc = NumberUtils.toDouble(paramsMap.getOrDefault("minValidCopc", "0.8"));
|
|
|
|
|
+ double maxValidCopc = NumberUtils.toDouble(paramsMap.getOrDefault("maxValidCopc", "10"));
|
|
|
|
|
+ double minCopc = NumberUtils.toDouble(paramsMap.getOrDefault("minCopc", "0.2"));
|
|
|
|
|
+ double maxCopc = NumberUtils.toDouble(paramsMap.getOrDefault("maxCopc", "2.5"));
|
|
|
|
|
+ calibrationCidCtcvr(result, calibModelName, reqFeature, minValidCopc, maxValidCopc, minCopc, maxCopc);
|
|
|
if (CollectionUtils.isEmpty(result)) {
|
|
if (CollectionUtils.isEmpty(result)) {
|
|
|
log.error("calculateCtcvrScore result is empty");
|
|
log.error("calculateCtcvrScore result is empty");
|
|
|
}
|
|
}
|
|
@@ -363,7 +369,7 @@ public class RankStrategyBy847 extends RankStrategyBasic {
|
|
|
double expLowerWeight = NumberUtils.toDouble(paramsMap.getOrDefault("expLowerWeight", "0.2"));
|
|
double expLowerWeight = NumberUtils.toDouble(paramsMap.getOrDefault("expLowerWeight", "0.2"));
|
|
|
double expUpperWeight = NumberUtils.toDouble(paramsMap.getOrDefault("expUpperWeight", "1.0"));
|
|
double expUpperWeight = NumberUtils.toDouble(paramsMap.getOrDefault("expUpperWeight", "1.0"));
|
|
|
double expScale = NumberUtils.toDouble(paramsMap.getOrDefault("expScale", "10.0"));
|
|
double expScale = NumberUtils.toDouble(paramsMap.getOrDefault("expScale", "10.0"));
|
|
|
- double anomWeight = NumberUtils.toDouble(paramsMap.getOrDefault("anomWeight", "1.0"));
|
|
|
|
|
|
|
+ int openH5 = NumberUtils.toInt(paramsMap.getOrDefault("openH5", "0"));
|
|
|
for (AdRankItem item : result) {
|
|
for (AdRankItem item : result) {
|
|
|
double bid = item.getCpa();
|
|
double bid = item.getCpa();
|
|
|
if (scoreParam.getExpCodeSet().contains(correctCpaExp1) || scoreParam.getExpCodeSet().contains(correctCpaExp2)) {
|
|
if (scoreParam.getExpCodeSet().contains(correctCpaExp1) || scoreParam.getExpCodeSet().contains(correctCpaExp2)) {
|
|
@@ -376,12 +382,10 @@ public class RankStrategyBy847 extends RankStrategyBasic {
|
|
|
isGuaranteeType = true;
|
|
isGuaranteeType = true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- double anomW = 1.0;
|
|
|
|
|
- boolean h5Page = this.landingH5Page(item);
|
|
|
|
|
- if (h5Page) {
|
|
|
|
|
- if (AnomalousCidDataHelper.contains(item.getAdId())) {
|
|
|
|
|
- anomW = anomWeight;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // h5 降权
|
|
|
|
|
+ double h5Weight = 1;
|
|
|
|
|
+ if (openH5 > 0) {
|
|
|
|
|
+ h5Weight = this.getH5SuppressWeight(item);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 控制曝光权重
|
|
// 控制曝光权重
|
|
@@ -397,14 +401,14 @@ public class RankStrategyBy847 extends RankStrategyBasic {
|
|
|
double layerAndCreativeWeight = getLayerAndCreativeWeight(layerAndCreativeWeightMapKey);
|
|
double layerAndCreativeWeight = getLayerAndCreativeWeight(layerAndCreativeWeightMapKey);
|
|
|
double scoreCoefficient = creativeScoreCoefficient.getOrDefault(item.getAdId(), 1d);
|
|
double scoreCoefficient = creativeScoreCoefficient.getOrDefault(item.getAdId(), 1d);
|
|
|
double guaranteeScoreCoefficient = getGuaranteeScoreCoefficient(isGuaranteedFlow, item.getExt());
|
|
double guaranteeScoreCoefficient = getGuaranteeScoreCoefficient(isGuaranteedFlow, item.getExt());
|
|
|
- double score = anomW * expWeight * item.getLrScore() * bid * scoreCoefficient * guaranteeScoreCoefficient * layerAndCreativeWeight;
|
|
|
|
|
|
|
+ double score = h5Weight * expWeight * item.getLrScore() * bid * scoreCoefficient * guaranteeScoreCoefficient * layerAndCreativeWeight;
|
|
|
item.getScoreMap().put("guaranteeScoreCoefficient", guaranteeScoreCoefficient);
|
|
item.getScoreMap().put("guaranteeScoreCoefficient", guaranteeScoreCoefficient);
|
|
|
item.getScoreMap().put("cpa", item.getCpa());
|
|
item.getScoreMap().put("cpa", item.getCpa());
|
|
|
item.getScoreMap().put("cpm", item.getCpm());
|
|
item.getScoreMap().put("cpm", item.getCpm());
|
|
|
item.getScoreMap().put("bid", bid);
|
|
item.getScoreMap().put("bid", bid);
|
|
|
item.getScoreMap().put("cpmCoefficient", cpmCoefficient);
|
|
item.getScoreMap().put("cpmCoefficient", cpmCoefficient);
|
|
|
item.getScoreMap().put("scoreCoefficient", scoreCoefficient);
|
|
item.getScoreMap().put("scoreCoefficient", scoreCoefficient);
|
|
|
- item.getScoreMap().put("anom", anomW);
|
|
|
|
|
|
|
+ item.getScoreMap().put("h5", h5Weight);
|
|
|
item.getFeatureMap().putAll(userFeatureMap);
|
|
item.getFeatureMap().putAll(userFeatureMap);
|
|
|
item.getFeatureMap().putAll(sceneFeatureMap);
|
|
item.getFeatureMap().putAll(sceneFeatureMap);
|
|
|
|
|
|
|
@@ -1009,4 +1013,27 @@ public class RankStrategyBy847 extends RankStrategyBasic {
|
|
|
double weight = Math.log(exp + 1) / scale;
|
|
double weight = Math.log(exp + 1) / scale;
|
|
|
return Math.min(Math.max(lowerWeight, weight), upperWeight);
|
|
return Math.min(Math.max(lowerWeight, weight), upperWeight);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private void calibrationCidCtcvr(List<AdRankItem> items, String modelName, Map<String, String> reqFeature,
|
|
|
|
|
+ double minValid, double maxValid,
|
|
|
|
|
+ double minVal, double maxVal) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ String layer = reqFeature.get("layer_l4");
|
|
|
|
|
+ for (AdRankItem item : items) {
|
|
|
|
|
+ String cid = String.valueOf(item.getAdId());
|
|
|
|
|
+ Double diff = CreativeUserLayerDataHelper.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.setLrScore(ctcvr);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("calibCidScore error", e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|