|
@@ -344,6 +344,15 @@ public class RankStrategyBy833 extends RankStrategyBasic {
|
|
|
.map(f -> f.get("layer"))
|
|
.map(f -> f.get("layer"))
|
|
|
.map(s -> s.replace("-炸", ""))
|
|
.map(s -> s.replace("-炸", ""))
|
|
|
.orElse(null);
|
|
.orElse(null);
|
|
|
|
|
+
|
|
|
|
|
+ // 控制曝光参数
|
|
|
|
|
+ String expOldKey = paramsMap.getOrDefault("expOldKey", "ad_view_yesterday");
|
|
|
|
|
+ double expOldThreshold = NumberUtils.toDouble(paramsMap.getOrDefault("expOldThreshold", "1000"));
|
|
|
|
|
+ String expNewKey = paramsMap.getOrDefault("expNewKey", "ad_view_today");
|
|
|
|
|
+ double expNewThreshold = NumberUtils.toDouble(paramsMap.getOrDefault("expNewThreshold", "3000"));
|
|
|
|
|
+ double expLowerWeight = NumberUtils.toDouble(paramsMap.getOrDefault("expLowerWeight", "0.2"));
|
|
|
|
|
+ double expUpperWeight = NumberUtils.toDouble(paramsMap.getOrDefault("expUpperWeight", "1.0"));
|
|
|
|
|
+ double expScale = NumberUtils.toDouble(paramsMap.getOrDefault("expScale", "10.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)) {
|
|
@@ -356,12 +365,20 @@ public class RankStrategyBy833 extends RankStrategyBasic {
|
|
|
isGuaranteeType = true;
|
|
isGuaranteeType = true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 控制曝光权重
|
|
|
|
|
+ Map<String, Map<String, String>> cidFeature = allCidFeature.getOrDefault(String.valueOf(item.getAdId()), EMPTY_NESTED_MAP);
|
|
|
|
|
+ Map<String, String> b3Feature = cidFeature.getOrDefault("alg_cid_feature_cid_action", EMPTY_STRING_MAP);
|
|
|
|
|
+ double expWeight = getExpWeight(b3Feature,
|
|
|
|
|
+ expOldKey, expOldThreshold,
|
|
|
|
|
+ expNewKey, expNewThreshold,
|
|
|
|
|
+ expLowerWeight, expUpperWeight, expScale);
|
|
|
|
|
+
|
|
|
String layerAndCreativeWeightMapKey = getLayerAndCreativeWeightMapKey(peopleLayer, String.valueOf(item.getAdId()));
|
|
String layerAndCreativeWeightMapKey = getLayerAndCreativeWeightMapKey(peopleLayer, String.valueOf(item.getAdId()));
|
|
|
// 人群分层&创意的权重
|
|
// 人群分层&创意的权重
|
|
|
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 = item.getLrScore() * bid * scoreCoefficient * guaranteeScoreCoefficient * layerAndCreativeWeight;
|
|
|
|
|
|
|
+ double score = 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());
|
|
@@ -936,4 +953,30 @@ public class RankStrategyBy833 extends RankStrategyBasic {
|
|
|
}
|
|
}
|
|
|
return newFeatureMap;
|
|
return newFeatureMap;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private double getExpWeight(Map<String, String> featureMap,
|
|
|
|
|
+ String expOldKey, double expOldThreshold,
|
|
|
|
|
+ String expNewKey, double expNewThreshold,
|
|
|
|
|
+ double expLowerWeight, double expUpperWeight, double expScale) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ if (null != featureMap) {
|
|
|
|
|
+ double oldView = Double.parseDouble(featureMap.getOrDefault(expOldKey, "0"));
|
|
|
|
|
+ if (oldView < expOldThreshold) {
|
|
|
|
|
+ double newView = Double.parseDouble(featureMap.getOrDefault(expNewKey, "0"));
|
|
|
|
|
+ return getExpWeight(expLowerWeight, expUpperWeight, expScale, expNewThreshold, newView);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("getExpWeight error: ", e);
|
|
|
|
|
+ }
|
|
|
|
|
+ return 1.0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private double getExpWeight(double lowerWeight, double upperWeight, double scale, double upperExp, double exp) {
|
|
|
|
|
+ if (exp >= upperExp) {
|
|
|
|
|
+ return 1.0;
|
|
|
|
|
+ }
|
|
|
|
|
+ double weight = Math.log(exp + 1) / scale;
|
|
|
|
|
+ return Math.min(Math.max(lowerWeight, weight), upperWeight);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|