|
@@ -38,6 +38,7 @@ public class RankService683 extends RankStrategyXGBBasic {
|
|
|
|
|
|
long ts = System.currentTimeMillis() / 1000;
|
|
long ts = System.currentTimeMillis() / 1000;
|
|
|
|
|
|
|
|
+ long start = System.currentTimeMillis();
|
|
// 特征处理
|
|
// 特征处理
|
|
Feature feature = this.getFeature(scoreParam, request);
|
|
Feature feature = this.getFeature(scoreParam, request);
|
|
|
|
|
|
@@ -62,6 +63,7 @@ public class RankService683 extends RankStrategyXGBBasic {
|
|
Map<String, String> e2Feature = userFeature.getOrDefault("alg_mid_feature_share_tags", new HashMap<>());
|
|
Map<String, String> e2Feature = userFeature.getOrDefault("alg_mid_feature_share_tags", new HashMap<>());
|
|
|
|
|
|
Map<String, String> sceneFeatureMap = this.handleSceneFeature(ts);
|
|
Map<String, String> sceneFeatureMap = this.handleSceneFeature(ts);
|
|
|
|
+ long time1 = System.currentTimeMillis();
|
|
|
|
|
|
List<AdRankItem> adRankItems = new ArrayList<>(request.getAdIdList().size());
|
|
List<AdRankItem> adRankItems = new ArrayList<>(request.getAdIdList().size());
|
|
for (AdPlatformCreativeDTO dto : request.getAdIdList()) {
|
|
for (AdPlatformCreativeDTO dto : request.getAdIdList()) {
|
|
@@ -97,9 +99,13 @@ public class RankService683 extends RankStrategyXGBBasic {
|
|
this.handleD2Feature(vidRankMaps, cidFeatureMap, cidStr);
|
|
this.handleD2Feature(vidRankMaps, cidFeatureMap, cidStr);
|
|
|
|
|
|
String title = b1Feature.getOrDefault("cidtitle", "");
|
|
String title = b1Feature.getOrDefault("cidtitle", "");
|
|
|
|
+ long time21 = System.currentTimeMillis();
|
|
this.handleE1AndE2Feature(e1Feature, e2Feature, title, cidFeatureMap);
|
|
this.handleE1AndE2Feature(e1Feature, e2Feature, title, cidFeatureMap);
|
|
-
|
|
|
|
|
|
+ long time22 = System.currentTimeMillis();
|
|
this.handleD3AndB1Feature(d3Feature, title, cidFeatureMap);
|
|
this.handleD3AndB1Feature(d3Feature, title, cidFeatureMap);
|
|
|
|
+ long time23 = System.currentTimeMillis();
|
|
|
|
+ log.info("cost={} handleE1AndE2Feature={} handleD3AndB1Feature={}", time23 - time21, time22 - time21,
|
|
|
|
+ time23 - time22);
|
|
|
|
|
|
adRankItem.setFeatureMap(cidFeatureMap);
|
|
adRankItem.setFeatureMap(cidFeatureMap);
|
|
|
|
|
|
@@ -107,6 +113,7 @@ public class RankService683 extends RankStrategyXGBBasic {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ long time2 = System.currentTimeMillis();
|
|
// 分桶
|
|
// 分桶
|
|
this.readBucketFile();
|
|
this.readBucketFile();
|
|
userFeatureMap = this.featureBucket(userFeatureMap);
|
|
userFeatureMap = this.featureBucket(userFeatureMap);
|
|
@@ -115,9 +122,13 @@ public class RankService683 extends RankStrategyXGBBasic {
|
|
adRankItem.setFeatureMap(this.featureBucket(featureMap));
|
|
adRankItem.setFeatureMap(this.featureBucket(featureMap));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
// 打分排序
|
|
// 打分排序
|
|
List<AdRankItem> result = ScorerUtils.getScorerPipeline(ScorerUtils.XGBOOST_SCORE_CONF_683)
|
|
List<AdRankItem> result = ScorerUtils.getScorerPipeline(ScorerUtils.XGBOOST_SCORE_CONF_683)
|
|
.scoring(sceneFeatureMap, userFeatureMap, adRankItems);
|
|
.scoring(sceneFeatureMap, userFeatureMap, adRankItems);
|
|
|
|
+
|
|
|
|
+ long time3 = System.currentTimeMillis();
|
|
for (AdRankItem item : result) {
|
|
for (AdRankItem item : result) {
|
|
item.setScore(item.getLrScore() * item.getCpa());
|
|
item.setScore(item.getLrScore() * item.getCpa());
|
|
item.getScoreMap().put("cpa", item.getCpa());
|
|
item.getScoreMap().put("cpa", item.getCpa());
|
|
@@ -157,6 +168,10 @@ public class RankService683 extends RankStrategyXGBBasic {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ long time4 = System.currentTimeMillis();
|
|
|
|
+ log.info("cost={}, feature1={}, feature2={}, getScorerPipeline={}, loop={}",
|
|
|
|
+ time4 - start, time1 - start, time2 - time1, time3 - time2, time4 - time3);
|
|
|
|
+
|
|
result.sort(ComparatorUtil.equalsRandomComparator());
|
|
result.sort(ComparatorUtil.equalsRandomComparator());
|
|
|
|
|
|
return result;
|
|
return result;
|